systemSmartyBase class provides some useful additional functions for Smarty and setup routines to ensure that the cache and compile folders are always created in a consistent manner. Any application using Smarty should run through this adaptor.
To use; simply instantiate and pass the name of the folder you want the cache files to be created in. This is usually the application or website domain name.
$oSmarty = new systemSmartyBase();
$oSmarty->setTemplateDir('/path/to/websites');
$oSmarty->setConfigDir('/path/to/config/folder');
$oSmarty->setCompileDir('myApp');
$oSmarty->setCacheDir('myApp');
$oSmarty->setUseSubDirs(true);
$oSmarty->assign('something','somevalue');
$oSmarty->display('template.tpl');
public __construct()
Create Smarty environment
public setCompileDir([$compile_dir = null])
Sets the compile dir, this should be the name of the application and NOT a full path
public setCacheDir([$cache_dir = null])
Set cache dir, this should be the name of the application and NOT a full path
protected checkFolderForPath($inFolder)
Checks if the folder is a path, returning the last item if it is
protected createFolder($inFolder)
Creates the folder $inFolder
Posted by: Scorpio Documentor (Writer), in System on 19 Nov 2009 @ 20:39
Tags: smarty, system, systemsmartybase,
This
work is licenced under a
Creative Commons Licence.