Welcome Guest, Not a member yet? Register   Sign In
Template (kind off)

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

You should have a main router view named /views/index.php with a body like this :
        <?php $this->view('include/header')?>

        &lt;?php $this->view('include/menu')?&gt;

    <div id="main">
        &lt;?php $this->view($content); ?&gt;

        &lt;?php $this->view('include/footer')?&gt;


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);

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 ;-)


Theme © iAndrew 2016 - Forum software by © MyBB