Welcome Guest, Not a member yet? Register   Sign In
Layout Engine
#4

[eluser]helmutbjorg[/eluser]
/controllers/test.php
Code:
function index() {

$data['view'] = 'index';
$this->load->view('template', $data);

}

function example() {

$data['view'] = 'example';
$this->load->view('template', $data);

}


/views/template.php
Code:
<html>
<head>
<title>My Template</title>
</head>
<body>
<h1>My Template</h1>

&lt;?php this->load->view($view); ?&gt;

&lt;/body&gt;
&lt;/html&gt;

/views/index.php
Code:
<p>This is custom index content</p>

/views/example.php
Code:
<p>And this is the example page content</p>


Pretty easy really eh!


Messages In This Thread
Layout Engine - by El Forum - 09-05-2009, 09:44 AM
Layout Engine - by El Forum - 09-05-2009, 10:00 AM
Layout Engine - by El Forum - 09-08-2009, 09:38 PM
Layout Engine - by El Forum - 09-09-2009, 01:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB