Welcome Guest, Not a member yet? Register   Sign In
One page view
#1

[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
#2

[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);
#3

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

[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?
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB