Welcome Guest, Not a member yet? Register   Sign In
Using multiple templates in the Template library by Jerome Jaglale/Maestric.com
#1

[eluser]tim peterson[/eluser]
I'm using the Template library developed by Jerome Jaglale for Codeigniter: http://maestric.com/doc/php/codeigniter_template.

I can't quite figure out how to use his example, advanced use #3, to load multiple templates. In his Template library, I feel like he doesn't actually demonstrate the loading of multiple templates in the load_main() function below:

Code:
function load_main($view = '', $view_data = array(), $return = FALSE)
{
$this->set('nav_list', array('Home', 'Photos', 'About', 'Contact'));
$this->load('template', $view, $view_data, $return);
    //shouldn't this be there?=> $this->load('template2', $view, $view_data, $return);
}
Am I correct? And if so, can you also give me some hints on how the controller and view files would look?

here's what Jerome has for the controller:
Code:
$this->template->set('nav', 'About');
$this->template->set('title', 'About me');
$this->template->load_main('about');
And the template view:

Code:
<html>
<body>
    <div id="contents">&lt;?= $contents ?&gt;</div>
    <div id="footer">Copyright 2008</div>
<ul class="navigation">
&lt;?php foreach($nav_list  as $i => $nav_item): ?&gt;
    <li class="&lt;?= ($nav == $nav_item ? 'selected' : '')?&gt;">
        &lt;?= anchor($nav_item, $nav_item) ?&gt;
    </li>
&lt;?php endforeach ?&gt;
</ul>
&lt;/body&gt;
&lt;/html&gt;
any help would be greatly appreciated,

thank you, tim




Theme © iAndrew 2016 - Forum software by © MyBB