![]() |
Building a master page. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Building a master page. (/showthread.php?tid=27394) |
Building a master page. - El Forum - 02-09-2010 [eluser]ronn[/eluser] I'm attempting to mimic a master page concept. What I want to do is create a master view complete with header, navigation, and footer. Then when I call another view such as landing_view. I would like my page to pull in the master page and render as a complete page. So the landing_view would just have the content specific to the landing page, and pull in the master header, footer, and navigation. How would this be done in CodeIgniter? I hope I'm explaining this well. Building a master page. - El Forum - 02-09-2010 [eluser]eoinmcg[/eluser] If I understand correctly... views/master.php Code: <?php $this->load->view('header'); ?> and from your various controllers: Code: $data['view'] = 'path/to/view'; Building a master page. - El Forum - 02-09-2010 [eluser]ronn[/eluser] Yes, that will work, but it will not change the url correct. It will always show under the /master url, correct? Is there anyway to do it that way and still change the url? Building a master page. - El Forum - 02-09-2010 [eluser]eoinmcg[/eluser] No, it won't change the url at all. Take a look at http://ellislab.com/codeigniter/user-guide/general/urls.html Each controller/method can load the master view and pass a view to be loaded. For example if you have a News controller with an 'archive' method: Code: class News extends Controller http://yoursite/news/archive If that's still not clear, browse through the user guide and take a look at http://codeigniter.com/tutorials/ Good luck Building a master page. - El Forum - 02-09-2010 [eluser]ronn[/eluser] Thanks eoinmcg. That helps me out greatly. |