EllisLab text mark
Advanced Search
     
Template (kind off)
Posted: 15 November 2012 07:30 AM   [ Ignore ]
Joined: 2012-03-06
38 posts

Hi all,

I was wondering what’s the best way to only load {header}, {menu} and {footer} only once throughout the application and just dynamically change the {content} according to the link being clicked?

Thanks in advance
/jurgen

 
Posted: 15 November 2012 07:39 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2010-07-20
74 posts

You should have a main router view named /views/index.php with a body like this :

<body
    <
header>
        
<?php $this->view('include/header')?>
    
</header>

    <
aside>
        
<?php $this->view('include/menu')?>
    
</aside>
 
    <
div id="main"
        
<?php $this->view($content); ?>
    
</div>

    <
footer>
        
<?php $this->view('include/footer')?>
    
</footer>

</
body

that you call in all of your controllers functions, and you dynamically pass your content template to load into the view :

$data->content 'page/content';
$this->load->view('index'$data); 
 
Posted: 15 November 2012 07:41 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-03-06
38 posts

Thanks a lot!
I’ve seen al kinds of solutions while googling, but this one definitely seems the best and easiest out there.
Thank you wink

/jurgen