aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2010-03-07 14:24:02 +0000
committervdigital <vdigital@piwigo.org>2010-03-07 14:24:02 +0000
commit0f7a952bdbcb80823914085676b310594547001a (patch)
treecd4729089deb54343b0f801e22e22091f7d7365d
parent0720fb6ac32ba2aa1073207d396bc87ed3b42130 (diff)
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
-rw-r--r--include/template.class.php20
1 files 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 );