]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
first try to implement theming support, which currently does not work at all
authorChristian Weiske <cweiske@cweiske.de>
Mon, 23 May 2011 04:53:31 +0000 (06:53 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 23 May 2011 04:53:31 +0000 (06:53 +0200)
53 files changed:
data/config.default.php
data/templates/default/about.tpl.php [moved from data/templates/about.tpl.php with 100% similarity]
data/templates/default/admin.tpl.php [moved from data/templates/admin.tpl.php with 100% similarity]
data/templates/default/bookmarkcommondescriptionedit.tpl.php [moved from data/templates/bookmarkcommondescriptionedit.tpl.php with 100% similarity]
data/templates/default/bookmarklet.inc.php [moved from data/templates/bookmarklet.inc.php with 100% similarity]
data/templates/default/bookmarks-thumbnail.inc.tpl.php [moved from data/templates/bookmarks-thumbnail.inc.tpl.php with 100% similarity]
data/templates/default/bookmarks-vote-horizontal.inc.tpl.php [moved from data/templates/bookmarks-vote-horizontal.inc.tpl.php with 100% similarity]
data/templates/default/bookmarks-vote.inc.tpl.php [moved from data/templates/bookmarks-vote.inc.tpl.php with 100% similarity]
data/templates/default/bookmarks.tpl.php [moved from data/templates/bookmarks.tpl.php with 100% similarity]
data/templates/default/bottom.inc.php [moved from data/templates/bottom.inc.php with 100% similarity]
data/templates/default/dojo.inc.php [moved from data/templates/dojo.inc.php with 100% similarity]
data/templates/default/dynamictags.inc.php [moved from data/templates/dynamictags.inc.php with 100% similarity]
data/templates/default/editbookmark.tpl.php [moved from data/templates/editbookmark.tpl.php with 100% similarity]
data/templates/default/editprofile-sslclientcerts.tpl.php [moved from data/templates/editprofile-sslclientcerts.tpl.php with 100% similarity]
data/templates/default/editprofile.tpl.php [moved from data/templates/editprofile.tpl.php with 100% similarity]
data/templates/default/error.404.tpl.php [moved from data/templates/error.404.tpl.php with 100% similarity]
data/templates/default/error.500.tpl.php [moved from data/templates/error.500.tpl.php with 100% similarity]
data/templates/default/importDelicious.tpl.php [moved from data/templates/importDelicious.tpl.php with 100% similarity]
data/templates/default/importNetscape.tpl.php [moved from data/templates/importNetscape.tpl.php with 100% similarity]
data/templates/default/importStructure.tpl.php [moved from data/templates/importStructure.tpl.php with 100% similarity]
data/templates/default/login.tpl.php [moved from data/templates/login.tpl.php with 100% similarity]
data/templates/default/password.tpl.php [moved from data/templates/password.tpl.php with 100% similarity]
data/templates/default/profile.tpl.php [moved from data/templates/profile.tpl.php with 100% similarity]
data/templates/default/register.tpl.php [moved from data/templates/register.tpl.php with 100% similarity]
data/templates/default/rss.tpl.php [moved from data/templates/rss.tpl.php with 100% similarity]
data/templates/default/search.menu.php [moved from data/templates/search.menu.php with 100% similarity]
data/templates/default/sidebar.block.common.php [moved from data/templates/sidebar.block.common.php with 100% similarity]
data/templates/default/sidebar.block.linked.php [moved from data/templates/sidebar.block.linked.php with 100% similarity]
data/templates/default/sidebar.block.menu.php [moved from data/templates/sidebar.block.menu.php with 100% similarity]
data/templates/default/sidebar.block.menu2.php [moved from data/templates/sidebar.block.menu2.php with 100% similarity]
data/templates/default/sidebar.block.popular.php [moved from data/templates/sidebar.block.popular.php with 100% similarity]
data/templates/default/sidebar.block.recent.php [moved from data/templates/sidebar.block.recent.php with 100% similarity]
data/templates/default/sidebar.block.related.php [moved from data/templates/sidebar.block.related.php with 100% similarity]
data/templates/default/sidebar.block.search.php [moved from data/templates/sidebar.block.search.php with 100% similarity]
data/templates/default/sidebar.block.tagactions.php [moved from data/templates/sidebar.block.tagactions.php with 100% similarity]
data/templates/default/sidebar.block.users.php [moved from data/templates/sidebar.block.users.php with 100% similarity]
data/templates/default/sidebar.block.watchlist.php [moved from data/templates/sidebar.block.watchlist.php with 100% similarity]
data/templates/default/sidebar.block.watchstatus.php [moved from data/templates/sidebar.block.watchstatus.php with 100% similarity]
data/templates/default/sidebar.linkedtags.inc.php [moved from data/templates/sidebar.linkedtags.inc.php with 100% similarity]
data/templates/default/sidebar.tpl.php [moved from data/templates/sidebar.tpl.php with 100% similarity]
data/templates/default/tag2tagadd.tpl.php [moved from data/templates/tag2tagadd.tpl.php with 100% similarity]
data/templates/default/tag2tagdelete.tpl.php [moved from data/templates/tag2tagdelete.tpl.php with 100% similarity]
data/templates/default/tag2tagedit.tpl.php [moved from data/templates/tag2tagedit.tpl.php with 100% similarity]
data/templates/default/tagcommondescriptionedit.tpl.php [moved from data/templates/tagcommondescriptionedit.tpl.php with 100% similarity]
data/templates/default/tagdelete.tpl.php [moved from data/templates/tagdelete.tpl.php with 100% similarity]
data/templates/default/tagedit.tpl.php [moved from data/templates/tagedit.tpl.php with 100% similarity]
data/templates/default/tagrename.tpl.php [moved from data/templates/tagrename.tpl.php with 100% similarity]
data/templates/default/tags.tpl.php [moved from data/templates/tags.tpl.php with 100% similarity]
data/templates/default/toolbar.inc.php [moved from data/templates/toolbar.inc.php with 100% similarity]
data/templates/default/top.inc.php [moved from data/templates/top.inc.php with 100% similarity]
data/templates/default/users.tpl.php [moved from data/templates/users.tpl.php with 100% similarity]
src/SemanticScuttle/Model/Template.php
src/SemanticScuttle/Service/Template.php

index 8c47e0b0cbf2fa9627009ce8603b221a55735372..c850521a9c8d7105e7f586eb83dc9a492f308ae9 100644 (file)
@@ -63,6 +63,15 @@ $sidebarTopMessage  = '';
  */
 $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';
 
 
 /***************************************************
index ff5fbbe8c1de762eb9a7f22d0fdbf6079f4f9c3f..234e23f2d9ce5950f73ac4b6d88a8bb1227e89a3 100644 (file)
@@ -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()
index efa8d2854c937a2276dba363869ea03f0514cd79..df9634463d2d262c0311da07d64f580c56bc383e 100644 (file)
@@ -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;
     }
 }