[eluser]JoostV[/eluser]
I use one master template from which I include header, footer, navbar, and so on.
I always seem to have one content template that has to be loaded dynamically. I set this in the controller, before I load the main template, like so:
Code:
$this->data['pagvars']['contentview'] = 'name_of_template';
$this->load->view('template_main', $this->data);
Now, in the template I load this specified template, if it exists:
Code:
if (isset($pagvars['contentview']) && file_exists($pagvars['contentview'] . '.php')) {
// Contentview exists, so let's load it
require_once($pagvars['contentview'] . '.php');
}
else {
// Contentview is not set or does not exist
show_error ('Problem loading contentview');
}