git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@444 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
cweiske 2009-10-28 08:00:40 +00:00
parent 806d85f387
commit a63765a4ad

View file

@ -49,21 +49,35 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
}
function loadTemplate($template, $vars = NULL) {
if (substr($template, -4) != '.php')
$template .= '.php';
$tpl =& new Template($this->basedir .'/'. $template, $vars, $this);
/**
* Loads and displays a template file.
*
* @param string $template Template filename relative
* to template dir
* @param array $vars Array of template variables.
*
* @return Template Template object
*/
function loadTemplate($template, $vars = null)
{
if (substr($template, -4) != '.php') {
$template .= '.php';
}
$tpl = new Template($this->basedir .'/'. $template, $vars, $this);
$tpl->parse();
return $tpl;
}
}
class Template {
class Template
{
var $vars = array();
var $file = '';
var $templateservice;
function Template($file, $vars = NULL, &$templateservice) {
function Template($file, $vars = null, &$templateservice)
{
$this->vars = $vars;
$this->file = $file;
$this->templateservice = $templateservice;