Created
December 28, 2009 18:16
-
-
Save nerdmom/264823 to your computer and use it in GitHub Desktop.
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
// Makes it extremely easy to integrate code igniter and smarty as well as provide layout capabilites | |
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
require "smarty/Smarty.class.php"; | |
class Template extends Smarty{ | |
var $theme = "default"; | |
function __construct() | |
{ | |
$this->tpl = new Smarty(); | |
$this->tpl->template_dir = ROOTPATH . "templates/"; | |
$this->tpl->compile_dir = APPPATH . "libraries/smarty/templates_c/"; | |
$this->tpl->config_dir = APPPATH . "libraries/smarty/config/"; | |
$this->tpl->plugins_dir = APPPATH . "libraries/smarty/plugins/"; | |
} | |
function assign($key,$value) | |
{ | |
$this->tpl->assign($key,$value); | |
} | |
function display($template) | |
{ | |
$this->tpl->display($template); | |
} | |
function fetch($template) | |
{ | |
$this->tpl->fetch($template); | |
} | |
function layout($inner_template,$array) | |
{ | |
foreach($array as $key=>$val) { | |
$this->assign($key,$val); | |
} | |
$this->assign("inner_template",$inner_template); | |
$this->display($this->theme.".tpl"); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment