Building a master page. |
[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.
[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';
[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?
[eluser]eoinmcg[/eluser]
No, it won't change the url at all. Take a look at http://ellislab.com/codeigniter/user-gui.../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
|
Welcome Guest, Not a member yet? Register Sign In |