diff options
author | patdenice <patdenice@piwigo.org> | 2010-03-13 02:14:32 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-03-13 02:14:32 +0000 |
commit | f76ce16aa6bdc7d0e45cb8aa56c50acfced1034d (patch) | |
tree | 4ebaedbd1f35f6d4e7913352dd7c3e0bd5c47ed4 /include | |
parent | 7a81759fb0121c8bebd3764ecd3a4f2d1e190f85 (diff) |
Feature 1502
Extend for templates now work properly.
Bound template as to be renamed in bound theme...
git-svn-id: http://piwigo.org/svn/trunk@5126 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/template.class.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/include/template.class.php b/include/template.class.php index c31c50d2e..d982bbb8e 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -78,17 +78,14 @@ class Template { } $this->smarty->template_dir = array(); - if ( !empty($theme) ) - { - $this->set_theme($root, $theme, $path); - } + $this->set_theme($root, $theme, $path); $this->smarty->assign('lang_info', $lang_info); if (!defined('IN_ADMIN') and isset($conf['extents_for_templates'])) { $tpl_extents = unserialize($conf['extents_for_templates']); - $this->set_extents($tpl_extents, './template-extension/', true); + $this->set_extents($tpl_extents, './template-extension/', true, $theme); } } @@ -115,6 +112,10 @@ class Template { $this->smarty->append('themeconf', $themeconf, true); } + /** + * Add template directory for this Template object. + * Set compile id if not exists. + */ function set_template_dir($dir) { $this->smarty->template_dir[] = $dir; @@ -189,7 +190,7 @@ class Template { /** * Sets template extention filename for handles. */ - function set_extent($filename, $param, $dir='', $overwrite=true) + function set_extent($filename, $param, $dir='', $overwrite=true, $theme='N/A') { return $this->set_extents(array($filename => $param), $dir, $overwrite); } @@ -198,10 +199,8 @@ class Template { * Sets template extentions filenames for handles. * $filename_array should be an hash of filename => array( handle, param) or filename => handle */ - function set_extents($filename_array, $dir='', $overwrite=true) + function set_extents($filename_array, $dir='', $overwrite=true, $theme='N/A') { - global $user; - if (!is_array($filename_array)) { return false; @@ -212,13 +211,13 @@ class Template { { $handle = $value[0]; $param = $value[1]; - $tpl = $value[2]; + $thm = $value[2]; } elseif (is_string($value)) { $handle = $value; $param = 'N/A'; - $tpl = 'N/A'; + $thm = 'N/A'; } else { @@ -226,7 +225,7 @@ class Template { } if ((stripos(implode('',array_keys($_GET)), '/'.$param) !== false or $param == 'N/A') - and ($tpl == $user['theme'] or $tpl == 'N/A') + and ($thm == $theme) and (!isset($this->extents[$handle]) or $overwrite) and file_exists($dir . $filename)) { |