Created
February 1, 2012 12:06
-
-
Save cjbell/1716759 to your computer and use it in GitHub Desktop.
Codeigniter template for Lee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Controller (method) | |
class Base extends CI_Controller { | |
function index(){ | |
$data = array( | |
'page' => 'home', | |
'view' => 'pages/base/index.php' | |
); | |
$this->load->view('templates/base.php', $data); | |
} | |
function contact(){ | |
$data = array( | |
'page' => 'contact', | |
'view' => 'pages/base/contact.php' | |
); | |
$this->load->view('templates/base.php', $data); | |
} | |
} | |
?> | |
<?php | |
// Template file (base.php) | |
// You need to autoload the URL helper to use site_url and base_url | |
?> | |
<header> | |
<h1>Logo</h1> | |
<ul> | |
<li><a href="<?php echo site_url('base/')?>" class="<?php echo ($page == 'home') ? 'sel' : ''; ?>">Home</a></li> | |
<li><a href="<?php echo site_url('base/contact')?>" class="<?php echo ($page == 'contact') ? 'sel' : ''; ?>">Contact</a></li> | |
</ul> | |
</header> | |
<div> | |
<?php echo $this->load->view($view); ?> | |
</div> | |
<footer></footer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment