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

[eluser]jurlan[/eluser]
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
#2

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

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

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

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

&lt;/body&gt;

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

Code:
$data->content = 'page/content';
$this->load->view('index', $data);
#3

[eluser]jurlan[/eluser]
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 ;-)

/jurgen




Theme © iAndrew 2016 - Forum software by © MyBB