CodeIgniter Forums
One page view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: One page view (/showthread.php?tid=20288)



One page view - El Forum - 07-04-2009

[eluser]Unknown[/eluser]
Hi!

I`m new to CI and I want to start using it in my projects.
Now, I want to know if anyone using one file as template (view file)? How I mean it:

I want to create (for example) page with next parts: header, left, mid, right, footer. All parts are same for every section/page of site, except "mid" part.
How to do this?

PS Sorry for bad english


One page view - El Forum - 07-04-2009

[eluser]Dam1an[/eluser]
The easiest way would be to do something like this

View:
Code:
<body>
    <div id="header">Header</div>
    <div id="left">Left</div>
    <div id="middle">&lt;?=$main?&gt;</div>
    <div id="right">Right</div>
    <div id="footer">Footer</div>
&lt;/body&gt;

And then in the controller, get the contents of the main view by setting the 3rd param to true, as follows
Code:
$data['main'] = $this->load->view('main_content_view', null, true);
$this->load->view('master', $data);



One page view - El Forum - 07-04-2009

[eluser]Colin Williams[/eluser]
Dam1an, what fascinating organ do you possess to come up with these solutions!? Smile


One page view - El Forum - 07-04-2009

[eluser]Dam1an[/eluser]
[quote author="Colin Williams" date="1246748702"]Dam1an, what fascinating organ do you possess to come up with these solutions!? Smile[/quote]

I'd hate to just come out and tell you, so I'll make it fun and let you use your brain at the same time... Lets play hangman!
I use my _ _ _ _ _ to come up with these brilliant ideas... Who wants the first guess?


One page view - El Forum - 07-04-2009

[eluser]Unknown[/eluser]
Thank you Damian,
I founded this http://maestric.com/doc/php/codeigniter_template
but i think I`m going to use yours.