[eluser]Edemilson Lima[/eluser]
Quote:You don’t like to put the header and footer in different files but you are going to use the load->view method to load the header and footer ???
No, what I do is to load a base view, with the header and the footer in the same file. It is something like your base page example, but with the HMTL code for header and footer together.
Code:
$data['content'] = $this->load->view('content',$data,true); // partial view with dynamic data
Hmmmm... I have placed the load->view command inside the view file. Your example keep it in the controller, which is much better and give more control. Thank you for the tip!
But, what the third parameter does? I did not found anything about it in the user guide. Does it tell the function to return the view instead of print it?
Well, now I have a more clear picture. First I need to build every sub page block and after pass them to my base view. So, I must call my base view in the end of each function that produces a sub page in my application.
Anyway, I will need to load the main view in each function. But at least this give me more flexibility (for example, to change the page title to something related to the sub page). May be is possible to reduce code duplication by creating functions to load the header and footer views. What do you think?