first try to implement theming support, which currently does not work at all
This commit is contained in:
parent
97bba97049
commit
a11432db93
53 changed files with 33 additions and 2 deletions
data
config.default.php
templates/default
about.tpl.phpadmin.tpl.phpbookmarkcommondescriptionedit.tpl.phpbookmarklet.inc.phpbookmarks-thumbnail.inc.tpl.phpbookmarks-vote-horizontal.inc.tpl.phpbookmarks-vote.inc.tpl.phpbookmarks.tpl.phpbottom.inc.phpdojo.inc.phpdynamictags.inc.phpeditbookmark.tpl.phpeditprofile-sslclientcerts.tpl.phpeditprofile.tpl.phperror.404.tpl.phperror.500.tpl.phpimportDelicious.tpl.phpimportNetscape.tpl.phpimportStructure.tpl.phplogin.tpl.phppassword.tpl.phpprofile.tpl.phpregister.tpl.phprss.tpl.phpsearch.menu.phpsidebar.block.common.phpsidebar.block.linked.phpsidebar.block.menu.phpsidebar.block.menu2.phpsidebar.block.popular.phpsidebar.block.recent.phpsidebar.block.related.phpsidebar.block.search.phpsidebar.block.tagactions.phpsidebar.block.users.phpsidebar.block.watchlist.phpsidebar.block.watchstatus.phpsidebar.linkedtags.inc.phpsidebar.tpl.phptag2tagadd.tpl.phptag2tagdelete.tpl.phptag2tagedit.tpl.phptagcommondescriptionedit.tpl.phptagdelete.tpl.phptagedit.tpl.phptagrename.tpl.phptags.tpl.phptoolbar.inc.phptop.inc.phpusers.tpl.php
src/SemanticScuttle
|
@ -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';
|
||||
|
||||
|
||||
/***************************************************
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue