<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Template {
	protected $ci;
	public $template_data = array();
	public function __construct() 
	{
		$this->ci = &get_instance();
	}
	function set($name, $value)
	{
		$this->template_data[$name] = $value;
	}
	public function load($layout, $content, $data = null, $return = false){
		$this->set('content',$this->ci->load->view($content, $data, true));
		return $this->ci->load->view("layouts/{$layout}", $this->template_data, $return);
	}
	public function front($layout, $content, $data = null, $return = false){
		$this->set('content',$this->ci->load->view($content, $data, true));
		return $this->ci->load->view("frontend/layouts/{$layout}", $this->template_data, $return);
	}
	public function back($layout, $content, $data = null, $return = false){
		$this->set('content',$this->ci->load->view($content, $data, true));
		return $this->ci->load->view("backend/layouts/{$layout}", $this->template_data, $return);
	}
}
