aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-10-21 20:16:01 +0000
committerrvelices <rv-github@modusoptimus.com>2006-10-21 20:16:01 +0000
commit641d335cff78b6e04c625ad3679547b73c1bb829 (patch)
tree9ec2e38e6b42d59e4050d8fd5865517dcd760e5c /include/template.php
parent8d7aa23a8e160c27bec20a21051b2d26217bcec9 (diff)
merge -r1568 from trunk to branch-1_6 (auto_login/redirect corrections)
git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1572 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/template.php')
-rw-r--r--include/template.php29
1 files changed, 21 insertions, 8 deletions
diff --git a/include/template.php b/include/template.php
index d93700b7a..df9c9a013 100644
--- a/include/template.php
+++ b/include/template.php
@@ -59,13 +59,22 @@ class Template {
// output
var $output = '';
+ var $themeconf = array();
+
/**
* Constructor. Simply sets the root dir.
*
*/
- function Template($root = ".")
+ function Template($root = ".", $theme= "")
{
- $this->set_rootdir($root);
+ if ( $this->set_rootdir($root) )
+ {
+ if ( !empty( $theme ) )
+ {
+ include($root.'/theme/'.$theme.'/themeconf.inc.php');
+ $this->themeconf = $themeconf;
+ }
+ }
}
/**
@@ -311,14 +320,14 @@ class Template {
{
die("Template->loadfile(): File $filename for handle $handle is empty");
}
-
+
$this->uncompiled_code[$handle] = $str;
-
+
return true;
}
-
-
-
+
+
+
/**
* Compiles the given string of code, and returns the result in a string.
*
@@ -331,7 +340,7 @@ class Template {
// PWG specific : communication between template and $lang
$code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code);
// PWG specific : expand themeconf.inc.php variables
- $code = preg_replace('/\{themeconf:([^}]+)\}/e', "get_themeconf('$1')", $code);
+ $code = preg_replace('/\{themeconf:([^}]+)\}/e', '$this->get_themeconf(\'$1\')', $code);
$code = preg_replace('/\{pwg_root\}/e', "get_root_url()", $code);
// replace \ with \\ and then ' with \'.
@@ -525,6 +534,10 @@ class Template {
return $varref;
}
+ function get_themeconf($key)
+ {
+ return isset($this->themeconf[$key]) ? $this->themeconf[$key] : '';
+ }
}
?>