aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-23 06:53:31 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-23 06:53:31 +0200
commita11432db93dbfdb0dbc78e1dd384663439799559 (patch)
tree374acc61a5be95bda099b355cc80582348d151bd /src/SemanticScuttle
parent97bba97049eeed2ecec022caa641b50ca507cb72 (diff)
downloadsemanticscuttle-a11432db93dbfdb0dbc78e1dd384663439799559.tar.gz
semanticscuttle-a11432db93dbfdb0dbc78e1dd384663439799559.tar.bz2
first try to implement theming support, which currently does not work at all
Diffstat (limited to 'src/SemanticScuttle')
-rw-r--r--src/SemanticScuttle/Model/Template.php3
-rw-r--r--src/SemanticScuttle/Service/Template.php23
2 files changed, 24 insertions, 2 deletions
diff --git a/src/SemanticScuttle/Model/Template.php b/src/SemanticScuttle/Model/Template.php
index ff5fbbe..234e23f 100644
--- a/src/SemanticScuttle/Model/Template.php
+++ b/src/SemanticScuttle/Model/Template.php
@@ -76,6 +76,9 @@ class SemanticScuttle_Model_Template
* 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()
diff --git a/src/SemanticScuttle/Service/Template.php b/src/SemanticScuttle/Service/Template.php
index efa8d28..df96344 100644
--- a/src/SemanticScuttle/Service/Template.php
+++ b/src/SemanticScuttle/Service/Template.php
@@ -38,6 +38,14 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
*/
protected $basedir;
+ /**
+ * The template theme to use.
+ * Set in constructor from $GLOBALS['theme']
+ *
+ * @var string
+ */
+ protected $theme;
+
/**
@@ -64,6 +72,8 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
protected function __construct()
{
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
+ $this->theme = $GLOBALS['theme'];
+ //FIXME: verify the theme exists
}
@@ -77,16 +87,25 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
*
* @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;
}
}