[eluser]rafabayona[/eluser]
I do this:
Master template:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo "$title - "; echo $this->config->item('sitename')?></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/default.css"/>
< script type="text/javascript" src="<?php echo base_url();?>assets/js/jquery-1.3.2.min.js"></ script>
</head>
<body>
<div id="wrapper">
<div id="header">
<?php $this->load->view('header');?>
</div><!--header-->
<div id="content">
<?php $this->load->view($main);?>
</div><!--Content-->
<div id="footer">
<?php $this->load->view('footer');?>
</div><!--footer-->
</div><!--Wrapper-->
</body>
</html>
The users/dashboard.php subview
Code:
<h2>Hi, user, welcome</h2>
<ul>Menu
<li><a href="#">Blah blah</a></li>
<li><a href="#">Blah blah</a></li>
<li><a href="#">Blah blah</a></li>
<li><a href="#">Blah blah</a></li>
</ul>
And loading the view in a controller
Code:
$data['title'] = 'Blah blah blah';
$data['main'] = 'users/dashboard'; //This is the sub-view I want to load as main content
$this->load->vars($data);
$this->load->view('master_template')