cs
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@444 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
806d85f387
commit
a63765a4ad
1 changed files with 20 additions and 6 deletions
|
@ -49,21 +49,35 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
|
||||||
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
|
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTemplate($template, $vars = NULL) {
|
/**
|
||||||
if (substr($template, -4) != '.php')
|
* 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';
|
$template .= '.php';
|
||||||
$tpl =& new Template($this->basedir .'/'. $template, $vars, $this);
|
}
|
||||||
|
$tpl = new Template($this->basedir .'/'. $template, $vars, $this);
|
||||||
$tpl->parse();
|
$tpl->parse();
|
||||||
|
|
||||||
return $tpl;
|
return $tpl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Template {
|
class Template
|
||||||
|
{
|
||||||
var $vars = array();
|
var $vars = array();
|
||||||
var $file = '';
|
var $file = '';
|
||||||
var $templateservice;
|
var $templateservice;
|
||||||
|
|
||||||
function Template($file, $vars = NULL, &$templateservice) {
|
function Template($file, $vars = null, &$templateservice)
|
||||||
|
{
|
||||||
$this->vars = $vars;
|
$this->vars = $vars;
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
$this->templateservice = $templateservice;
|
$this->templateservice = $templateservice;
|
||||||
|
|
Loading…
Reference in a new issue