- 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
This commit is contained in:
rvelices
2008-03-13 01:43:45 +00:00
parent 6f84eaf7cb
commit a6437b81e6
12 changed files with 132 additions and 117 deletions
+35 -1
View File
@@ -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 */