Smarty Templating Engine

Basic Usage

define('DS', DIRECTORY_SEPARATOR);// Stolen from Joomla
define('SITE_PATH', dirname(__FILE__));// Should be defined in a PHP script that is in the site root
define('SMARTY_PATH', dirname(SITE_PATH).DS.'smarty');// If the directory "smarty" is to contain all the necessary goodies and is next to the site root
define('SMARTY_DIR', SMARTY_PATH.DS.'libs'.DS);// Needed if Smarty can't figure it out itself

require SMARTY_DIR.'Smarty.class.php';

$smarty = new Smarty;

// Trailing slash (Win or 'nix style) required for each Dir variable
// Defaults to root folders
$smarty->setConfigDir(SMARTY_PATH.DS.'config'.DS);// Defaults to configs
$smarty->setTemplateDir(SMARTY_PATH.DS.'templates'.DS);// Defaults to templates
$smarty->setCompileDir(SMARTY_PATH.DS.'compiled'.DS);// Defaults to templates_c
$smarty->setCacheDir(SMARTY_PATH.DS.'cache'.DS);// Defaults to cache

//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;

$smarty->assign('menu', $menu);
$smarty->assign('title', $title);
$smarty->assign('pageTitle', $pageTitle);

$smarty->display('index.tpl');