Skip to content

Instantly share code, notes, and snippets.

@rihenperry
Created January 9, 2013 12:07
Show Gist options
  • Save rihenperry/4492647 to your computer and use it in GitHub Desktop.
Save rihenperry/4492647 to your computer and use it in GitHub Desktop.
<?php
class Pages extends CI_Controller {
public function view($page = 'home')
{
if ( ! file_exists('application/views/pages/'.$page.'.php')) {
// show the fatal 404 error.
// the below function is CodeIgnitor's native built-in function
show_404();
}
$data['title'] = ucfirst($page);
$this->load->view('templates/header',$data);
$this->load->view('pages/'.$page,$data);
$this->load->view('templates/footer',$data);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment