*/
$sidebarBottomMessage = '';
+/**
+ * The HTML theme to use. With themes, you can give your semanticscuttle
+ * installation a new look.
+ *
+ * Themes are the folders in data/templates/
+ *
+ * @var string
+ */
+$theme = 'default';
/***************************************************
* Sets variables and includes the template file,
* causing it to be rendered.
*
+ * Does not take care of themes and so.
+ * The include path must be set so the correct theme is used.
+ *
* @return void
*/
public function parse()
*/
protected $basedir;
+ /**
+ * The template theme to use.
+ * Set in constructor from $GLOBALS['theme']
+ *
+ * @var string
+ */
+ protected $theme;
+
/**
protected function __construct()
{
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
+ $this->theme = $GLOBALS['theme'];
+ //FIXME: verify the theme exists
}
*
* @return SemanticScuttle_Model_Template Template object
*/
- function loadTemplate($template, $vars = null)
+ public function loadTemplate($template, $vars = null)
{
if (substr($template, -4) != '.php') {
$template .= '.php';
}
+
+ $oldIncPath = get_include_path();
+ set_include_path(
+ $this->basedir . $this->theme
+ . PATH_SEPARATOR . $this->basedir . 'default'
+ );
+
$tpl = new SemanticScuttle_Model_Template(
- $this->basedir .'/'. $template, $vars, $this
+ $template, $vars, $this
);
$tpl->parse();
+ set_include_path($oldIncPath);
+
return $tpl;
}
}