Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phil Sturgeon’s Template Library with Theme Issue

Even though PyroCMS is an excellent CMS to use and I highly recommend anybody and everybody using when the situation grants it.

However, my situation calls for a custom CMS that just has quite a bit of differences that I am instead developing mine with the use of some of the libraries I see out there that are free to use. The main one I am currently working with right now is Phil Sturgeon’s Template library.

Now since obviously he uses it for PyroCMS I am trying to match up as close to a file structure as he does with that so that the template system will flow smoothly without any issues.

I am currently in a quandary right now because I have my login form is not finding a partial and I’m not quite sure why. When my dashboard calls the metadata partial it loads it up just fine but something is amidst and is not loading it when I call it in the login form.

Here is my current login controller, login form view, and the file structure to ensure it is set up properly.

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends Backend_Controller 
{
    public function __construct()
    {
        parent::__construct(); 
    }

public function index()
{ 
    $this->template
           ->set_layout(FALSE)
           ->build('login');
    }
}

<head>

    <!-- metadata needs to load before some stuff -->
    <?php file_partial('metadata'); ?>

</head> 

applications/
    themes/
        supr(my custom theme from template)/
            views/
                login.php
                partials/
                    metadata.php  

Any ideas from anyone?

like image 574
Kevin Smith Avatar asked Oct 06 '22 02:10

Kevin Smith


1 Answers

In your controller:

$this->template
    ->set_layout(FALSE)
    ->set_partial('metadata', 'partials/metadata.php')
    ->build('login');
}

note the added call to set_partial.

In your view:

<?php echo $template['partials']['metadata']; ?>
like image 51
bradym Avatar answered Oct 10 '22 02:10

bradym