Welcome Guest, Not a member yet? Register   Sign In
Please help Views and routes
#2

[eluser]whobutsb[/eluser]
Hi there,
You might want to try this strategy. Create a view file called "template.php".
In your template make this the skeleton of your page that will have all the normal HTML elements:

Code:
<html>
<head>
    <title><?= $pageTitle; ?></title>
</head>

<body>
    
    <?php $this->load->view('view_header'); ?>
    
    <?php $this->load->view($view_body); ?>
    
    <?php $this->load->view('view_footer'); ?>
</body>


</html>


In your controller you could write it like this:

Code:
function index(){
    
    $data['pageTitle'] = 'mysite';
    $data['view_body'] = 'view_page1';
    
    $this->load->view('template', $data);

}


This is typically how I organize my CI projects.


Messages In This Thread
Please help Views and routes - by El Forum - 10-13-2010, 05:19 AM
Please help Views and routes - by El Forum - 10-13-2010, 08:22 AM
Please help Views and routes - by El Forum - 10-13-2010, 01:24 PM
Please help Views and routes - by El Forum - 10-13-2010, 05:02 PM
Please help Views and routes - by El Forum - 10-13-2010, 05:29 PM
Please help Views and routes - by El Forum - 10-13-2010, 05:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB