One structure and more contents.. |
[eluser]ariok[/eluser]
Hi all! i'm really new with codeIgniter.. and i'd like to understand if CI is what i'm looking for.. i have a little question about how to struct a page when i need to repeat a structure and i have to change contents only. Example: i need two pages , "HOME" and "NEWS". In this pages my footer, header and navigation bar are the same but in HOME i have contents for HOME and in NEWS contents for NEWS. now... how to struct a situation like this in CI ?? Do i need to create different views for all Pages(news and home), with only few differences in contents??in this case... i have to repeat footer menu and header in all of my views!!??? uhm... Thank you
[eluser]ariok[/eluser]
i find this solution.. Two controllers, home.php and news.php which share a view I.E. Code: //home.php--------------------- but i'm not sure this is the better solution.. What do you think about that?
[eluser]ariok[/eluser]
looking around i find this code...do you think this could be interesting for my problemS? Code: function _load_views()
[eluser]ariok[/eluser]
http://codeigniter.com/wiki/Displaying_Multiple_Views/ here the solution... ehm...thank you...
[eluser]Cappinator[/eluser]
Hi Ariok, That's what I use too. I put all that stuff into a library. Here's the code in case you're interested: libraries/Template.php: Code: <?php For a page such as your Home page, you could use this: controllers/home.php Code: <?php views/template/header.php Code: <html> views/template/footer.php: Code: <?=$page_footer?><br /> And your home.php file would contain just the contents of that page. Same goes for your news page. |
Welcome Guest, Not a member yet? Register Sign In |