aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.class.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-03-13 01:43:45 +0000
committerrvelices <rv-github@modusoptimus.com>2008-03-13 01:43:45 +0000
commita6437b81e68d5b14ded9cd2eaed7f134999ab794 (patch)
tree19b4cb1e5bb320887641edb8d24bd56e369d37f4 /include/template.class.php
parent6f84eaf7cb10b0db6e82a3c85d998e60a3654c9a (diff)
- changes to template to accomodate nbm (solved issue when we had same template filename with different root dirs)
- started some changes in mail templates git-svn-id: http://piwigo.org/svn/trunk@2278 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/template.class.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/include/template.class.php b/include/template.class.php
index 77b6df5f0..f5faa7d94 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -78,7 +78,6 @@ class Template {
$this->smarty->compile_dir = $compile_dir;
- $this->smarty->template_dir = $root;
$this->smarty->register_function( 'lang', array('Template', 'fn_l10n') );
$this->smarty->assign_by_ref( 'pwg', new PwgTemplateAdapter() );
@@ -91,6 +90,41 @@ class Template {
}
$this->_old = & new TemplateOld($root, $theme);
+
+ $this->set_template_dir($root);
+ }
+
+ /**
+ * Sets the template root directory for this Template object.
+ */
+ function set_template_dir($dir)
+ {
+ $this->_old->set_rootdir($dir);
+ $this->smarty->template_dir = $dir;
+
+ $real_dir = realpath($dir);
+ $compile_id = crc32( $real_dir===false ? $dir : $real_dir);
+ $this->smarty->compile_id = sprintf('%08X', $compile_id );
+ }
+
+ /**
+ * Gets the template root directory for this Template object.
+ */
+ function get_template_dir()
+ {
+ return $this->smarty->template_dir;
+ }
+
+ /**
+ * Deletes all compiled templates.
+ */
+ function delete_compiled_templates()
+ {
+ $save_compile_id = $this->smarty->compile_id;
+ $this->smarty->compile_id = null;
+ $this->smarty->clear_compiled_tpl();
+ $this->smarty->compile_id = $save_compile_id;
+ file_put_contents($this->smarty->compile_dir.'/index.htm', '');
}
/** DEPRECATED */