From 0f7a952bdbcb80823914085676b310594547001a Mon Sep 17 00:00:00 2001 From: vdigital Date: Sun, 7 Mar 2010 14:24:02 +0000 Subject: [PATCH] New feature: Template modeling to reduce coding efforts when you want to create a new template. git-svn-id: http://piwigo.org/svn/trunk@5071 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/template.class.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/template.class.php b/include/template.class.php index d71b23263..8d5f91a25 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -96,11 +96,27 @@ class Template { /** * Sets the template root directory for this Template object. + * Revised from Piwigo 2.1 to add modeling support */ function set_template_dir($dir) { - $this->smarty->template_dir = $dir; - + if (!defined('IN_ADMIN')) + { // Modeling is active only on gallery side and never in admin + // Set the normal directory + $this->smarty->template_dir = array($dir); + // Modeling by theme parameter + $modeling = './template/' . $this->get_themeconf('modeling'); + if ( $modeling != './template/' and is_dir($modeling)) + { + $this->smarty->template_dir[] = $modeling; + } + // Default template directory + $this->smarty->template_dir[] = './template-common/yoga'; + } + else + { + $this->smarty->template_dir = $dir; + } $real_dir = realpath($dir); $compile_id = crc32( $real_dir===false ? $dir : $real_dir); $this->smarty->compile_id = base_convert($compile_id, 10, 36 );