aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2008-07-14 21:42:40 +0000
committervdigital <vdigital@piwigo.org>2008-07-14 21:42:40 +0000
commitdf29ffbde72e88635f454d5d6d84c5a7209460f3 (patch)
tree0a35be2731fe75fe86e11adad6f0147f180956d8 /include
parentb7709eae0dcb81df9eb668407b64f2cde38ba1f0 (diff)
Feature template-extension based on 2006 chrisaga's idea.
chrisaga wrote: "If you want to make some template customization without building a brand new template, you should use ..." git-svn-id: http://piwigo.org/svn/trunk@2434 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/template.class.php28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/template.class.php b/include/template.class.php
index 1fd3c94ac..e7ab39b8d 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -145,22 +145,44 @@ class Template {
*/
function set_filenames($filename_array)
{
+ global $conf;
if (!is_array($filename_array))
{
return false;
}
-
reset($filename_array);
+ $tpl_extension = isset($conf['extents_for_templates']) ?
+ unserialize($conf['extents_for_templates']) : array();
while(list($handle, $filename) = each($filename_array))
{
if (is_null($filename))
unset( $this->files[$handle] );
else
- $this->files[$handle] = $filename;
+ {
+ if (!isset($this->files[$handle])) $this->files[$handle] = $filename;
+ foreach ($tpl_extension as $file => $conditions)
+ {
+ $localtpl = './template-extension/' . $file;
+ if ($handle == $conditions[0] and
+ (stripos(implode('/',array_flip($_GET)),$conditions[1])>0
+ or $conditions[1] == 'N/A')
+ and file_exists($localtpl))
+ { /* examples: Are best_rated, created-monthly-calendar, list, ... set? */
+ $this->files[$handle] = '../.' . $localtpl;
+ /* assign their tpl-extension */
+ /* For test purpose: Do advanced users need a php access? */
+ // $localphp = '../.' . substr($localtpl,0,-3).'php';
+ // if (file_exists($localphp)) @include_once($localphp);
+ }
+ }
+ }
}
return true;
}
-
+ function on_extension($key, $tlpname)
+ {
+ return $tplname;
+ }
/** see smarty assign http://www.smarty.net/manual/en/api.assign.php */
function assign($tpl_var, $value = null)
{