diff --git a/data/config.default.php b/data/config.default.php index 8c47e0b..c850521 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -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'; /*************************************************** diff --git a/data/templates/about.tpl.php b/data/templates/default/about.tpl.php similarity index 100% rename from data/templates/about.tpl.php rename to data/templates/default/about.tpl.php diff --git a/data/templates/admin.tpl.php b/data/templates/default/admin.tpl.php similarity index 100% rename from data/templates/admin.tpl.php rename to data/templates/default/admin.tpl.php diff --git a/data/templates/bookmarkcommondescriptionedit.tpl.php b/data/templates/default/bookmarkcommondescriptionedit.tpl.php similarity index 100% rename from data/templates/bookmarkcommondescriptionedit.tpl.php rename to data/templates/default/bookmarkcommondescriptionedit.tpl.php diff --git a/data/templates/bookmarklet.inc.php b/data/templates/default/bookmarklet.inc.php similarity index 100% rename from data/templates/bookmarklet.inc.php rename to data/templates/default/bookmarklet.inc.php diff --git a/data/templates/bookmarks-thumbnail.inc.tpl.php b/data/templates/default/bookmarks-thumbnail.inc.tpl.php similarity index 100% rename from data/templates/bookmarks-thumbnail.inc.tpl.php rename to data/templates/default/bookmarks-thumbnail.inc.tpl.php diff --git a/data/templates/bookmarks-vote-horizontal.inc.tpl.php b/data/templates/default/bookmarks-vote-horizontal.inc.tpl.php similarity index 100% rename from data/templates/bookmarks-vote-horizontal.inc.tpl.php rename to data/templates/default/bookmarks-vote-horizontal.inc.tpl.php diff --git a/data/templates/bookmarks-vote.inc.tpl.php b/data/templates/default/bookmarks-vote.inc.tpl.php similarity index 100% rename from data/templates/bookmarks-vote.inc.tpl.php rename to data/templates/default/bookmarks-vote.inc.tpl.php diff --git a/data/templates/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php similarity index 100% rename from data/templates/bookmarks.tpl.php rename to data/templates/default/bookmarks.tpl.php diff --git a/data/templates/bottom.inc.php b/data/templates/default/bottom.inc.php similarity index 100% rename from data/templates/bottom.inc.php rename to data/templates/default/bottom.inc.php diff --git a/data/templates/dojo.inc.php b/data/templates/default/dojo.inc.php similarity index 100% rename from data/templates/dojo.inc.php rename to data/templates/default/dojo.inc.php diff --git a/data/templates/dynamictags.inc.php b/data/templates/default/dynamictags.inc.php similarity index 100% rename from data/templates/dynamictags.inc.php rename to data/templates/default/dynamictags.inc.php diff --git a/data/templates/editbookmark.tpl.php b/data/templates/default/editbookmark.tpl.php similarity index 100% rename from data/templates/editbookmark.tpl.php rename to data/templates/default/editbookmark.tpl.php diff --git a/data/templates/editprofile-sslclientcerts.tpl.php b/data/templates/default/editprofile-sslclientcerts.tpl.php similarity index 100% rename from data/templates/editprofile-sslclientcerts.tpl.php rename to data/templates/default/editprofile-sslclientcerts.tpl.php diff --git a/data/templates/editprofile.tpl.php b/data/templates/default/editprofile.tpl.php similarity index 100% rename from data/templates/editprofile.tpl.php rename to data/templates/default/editprofile.tpl.php diff --git a/data/templates/error.404.tpl.php b/data/templates/default/error.404.tpl.php similarity index 100% rename from data/templates/error.404.tpl.php rename to data/templates/default/error.404.tpl.php diff --git a/data/templates/error.500.tpl.php b/data/templates/default/error.500.tpl.php similarity index 100% rename from data/templates/error.500.tpl.php rename to data/templates/default/error.500.tpl.php diff --git a/data/templates/importDelicious.tpl.php b/data/templates/default/importDelicious.tpl.php similarity index 100% rename from data/templates/importDelicious.tpl.php rename to data/templates/default/importDelicious.tpl.php diff --git a/data/templates/importNetscape.tpl.php b/data/templates/default/importNetscape.tpl.php similarity index 100% rename from data/templates/importNetscape.tpl.php rename to data/templates/default/importNetscape.tpl.php diff --git a/data/templates/importStructure.tpl.php b/data/templates/default/importStructure.tpl.php similarity index 100% rename from data/templates/importStructure.tpl.php rename to data/templates/default/importStructure.tpl.php diff --git a/data/templates/login.tpl.php b/data/templates/default/login.tpl.php similarity index 100% rename from data/templates/login.tpl.php rename to data/templates/default/login.tpl.php diff --git a/data/templates/password.tpl.php b/data/templates/default/password.tpl.php similarity index 100% rename from data/templates/password.tpl.php rename to data/templates/default/password.tpl.php diff --git a/data/templates/profile.tpl.php b/data/templates/default/profile.tpl.php similarity index 100% rename from data/templates/profile.tpl.php rename to data/templates/default/profile.tpl.php diff --git a/data/templates/register.tpl.php b/data/templates/default/register.tpl.php similarity index 100% rename from data/templates/register.tpl.php rename to data/templates/default/register.tpl.php diff --git a/data/templates/rss.tpl.php b/data/templates/default/rss.tpl.php similarity index 100% rename from data/templates/rss.tpl.php rename to data/templates/default/rss.tpl.php diff --git a/data/templates/search.menu.php b/data/templates/default/search.menu.php similarity index 100% rename from data/templates/search.menu.php rename to data/templates/default/search.menu.php diff --git a/data/templates/sidebar.block.common.php b/data/templates/default/sidebar.block.common.php similarity index 100% rename from data/templates/sidebar.block.common.php rename to data/templates/default/sidebar.block.common.php diff --git a/data/templates/sidebar.block.linked.php b/data/templates/default/sidebar.block.linked.php similarity index 100% rename from data/templates/sidebar.block.linked.php rename to data/templates/default/sidebar.block.linked.php diff --git a/data/templates/sidebar.block.menu.php b/data/templates/default/sidebar.block.menu.php similarity index 100% rename from data/templates/sidebar.block.menu.php rename to data/templates/default/sidebar.block.menu.php diff --git a/data/templates/sidebar.block.menu2.php b/data/templates/default/sidebar.block.menu2.php similarity index 100% rename from data/templates/sidebar.block.menu2.php rename to data/templates/default/sidebar.block.menu2.php diff --git a/data/templates/sidebar.block.popular.php b/data/templates/default/sidebar.block.popular.php similarity index 100% rename from data/templates/sidebar.block.popular.php rename to data/templates/default/sidebar.block.popular.php diff --git a/data/templates/sidebar.block.recent.php b/data/templates/default/sidebar.block.recent.php similarity index 100% rename from data/templates/sidebar.block.recent.php rename to data/templates/default/sidebar.block.recent.php diff --git a/data/templates/sidebar.block.related.php b/data/templates/default/sidebar.block.related.php similarity index 100% rename from data/templates/sidebar.block.related.php rename to data/templates/default/sidebar.block.related.php diff --git a/data/templates/sidebar.block.search.php b/data/templates/default/sidebar.block.search.php similarity index 100% rename from data/templates/sidebar.block.search.php rename to data/templates/default/sidebar.block.search.php diff --git a/data/templates/sidebar.block.tagactions.php b/data/templates/default/sidebar.block.tagactions.php similarity index 100% rename from data/templates/sidebar.block.tagactions.php rename to data/templates/default/sidebar.block.tagactions.php diff --git a/data/templates/sidebar.block.users.php b/data/templates/default/sidebar.block.users.php similarity index 100% rename from data/templates/sidebar.block.users.php rename to data/templates/default/sidebar.block.users.php diff --git a/data/templates/sidebar.block.watchlist.php b/data/templates/default/sidebar.block.watchlist.php similarity index 100% rename from data/templates/sidebar.block.watchlist.php rename to data/templates/default/sidebar.block.watchlist.php diff --git a/data/templates/sidebar.block.watchstatus.php b/data/templates/default/sidebar.block.watchstatus.php similarity index 100% rename from data/templates/sidebar.block.watchstatus.php rename to data/templates/default/sidebar.block.watchstatus.php diff --git a/data/templates/sidebar.linkedtags.inc.php b/data/templates/default/sidebar.linkedtags.inc.php similarity index 100% rename from data/templates/sidebar.linkedtags.inc.php rename to data/templates/default/sidebar.linkedtags.inc.php diff --git a/data/templates/sidebar.tpl.php b/data/templates/default/sidebar.tpl.php similarity index 100% rename from data/templates/sidebar.tpl.php rename to data/templates/default/sidebar.tpl.php diff --git a/data/templates/tag2tagadd.tpl.php b/data/templates/default/tag2tagadd.tpl.php similarity index 100% rename from data/templates/tag2tagadd.tpl.php rename to data/templates/default/tag2tagadd.tpl.php diff --git a/data/templates/tag2tagdelete.tpl.php b/data/templates/default/tag2tagdelete.tpl.php similarity index 100% rename from data/templates/tag2tagdelete.tpl.php rename to data/templates/default/tag2tagdelete.tpl.php diff --git a/data/templates/tag2tagedit.tpl.php b/data/templates/default/tag2tagedit.tpl.php similarity index 100% rename from data/templates/tag2tagedit.tpl.php rename to data/templates/default/tag2tagedit.tpl.php diff --git a/data/templates/tagcommondescriptionedit.tpl.php b/data/templates/default/tagcommondescriptionedit.tpl.php similarity index 100% rename from data/templates/tagcommondescriptionedit.tpl.php rename to data/templates/default/tagcommondescriptionedit.tpl.php diff --git a/data/templates/tagdelete.tpl.php b/data/templates/default/tagdelete.tpl.php similarity index 100% rename from data/templates/tagdelete.tpl.php rename to data/templates/default/tagdelete.tpl.php diff --git a/data/templates/tagedit.tpl.php b/data/templates/default/tagedit.tpl.php similarity index 100% rename from data/templates/tagedit.tpl.php rename to data/templates/default/tagedit.tpl.php diff --git a/data/templates/tagrename.tpl.php b/data/templates/default/tagrename.tpl.php similarity index 100% rename from data/templates/tagrename.tpl.php rename to data/templates/default/tagrename.tpl.php diff --git a/data/templates/tags.tpl.php b/data/templates/default/tags.tpl.php similarity index 100% rename from data/templates/tags.tpl.php rename to data/templates/default/tags.tpl.php diff --git a/data/templates/toolbar.inc.php b/data/templates/default/toolbar.inc.php similarity index 100% rename from data/templates/toolbar.inc.php rename to data/templates/default/toolbar.inc.php diff --git a/data/templates/top.inc.php b/data/templates/default/top.inc.php similarity index 100% rename from data/templates/top.inc.php rename to data/templates/default/top.inc.php diff --git a/data/templates/users.tpl.php b/data/templates/default/users.tpl.php similarity index 100% rename from data/templates/users.tpl.php rename to data/templates/default/users.tpl.php 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; } }