Skip to content

Instantly share code, notes, and snippets.

@markwatson
Created December 12, 2008 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwatson/35061 to your computer and use it in GitHub Desktop.
Save markwatson/35061 to your computer and use it in GitHub Desktop.
Codeignitor full page templates.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
ob_start();
/**
* Template Library
*
* @package Template
* @category Libraries
* @author Mark Watson
* @link http://markedup.org
*
* A simple way to load view pages.
*/
class Template
{
/**
* Auth constructor
*
* @access public
*/
function __construct()
{
$this->CI =& get_instance();
} // Auth()
/**
* Show a template
*
* @access public
*/
function show($view, $data=NULL, $headers=NULL, $other=FALSE)
{
if (!$other)
{
$this->CI->load->view('_header.php', $headers);
$this->CI->load->view($view, $data);
$this->CI->load->view('_footer.php', $headers);
}
else
{
$this->CI->load->view($other.'/_header.php', $headers);
$this->CI->load->view($view, $data);
$this->CI->load->view($other.'/_footer.php', $headers);
}
}
}
/* End of file Template.php */
/* Location: application/libraries */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment