Changeset 5123 for trunk/include/template.class.php
- Timestamp:
- Mar 13, 2010, 1:00:52 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r5101 r5123 53 53 var $html_head_elements = array(); 54 54 55 function Template($root = ".", $theme= "" )55 function Template($root = ".", $theme= "", $path = "template") 56 56 { 57 57 global $conf, $lang_info; … … 78 78 } 79 79 80 $this->smarty->template_dir = array(); 80 81 if ( !empty($theme) ) 81 82 { 82 include($root.'/theme/'.$theme.'/themeconf.inc.php'); 83 $this->smarty->assign('themeconf', $themeconf); 83 $this->set_theme($root, $theme, $path); 84 84 } 85 85 86 86 $this->smarty->assign('lang_info', $lang_info); 87 88 $this->set_template_dir($root);89 87 90 88 if (!defined('IN_ADMIN') and isset($conf['extents_for_templates'])) … … 96 94 97 95 /** 98 * Sets the template root directory for this Template object. 99 * Revised from Piwigo 2.1 to add modeling support 100 */ 96 * Load theme's parameters. 97 */ 98 function set_theme($root, $theme, $path) 99 { 100 $this->set_template_dir($root.'/'.$theme.'/'.$path); 101 102 include($root.'/'.$theme.'/themeconf.inc.php'); 103 104 if (isset($themeconf['parent'])) 105 { 106 $this->set_theme($root, $themeconf['parent'], $path); 107 } 108 109 $tpl_var = array('name' => $themeconf['theme']); 110 if (file_exists($root.'/'.$theme.'/local_head.tpl')) 111 { 112 $tpl_var['local_head'] = realpath($root.'/'.$theme.'/local_head.tpl'); 113 } 114 $this->smarty->append('themes', $tpl_var); 115 $this->smarty->append('themeconf', $themeconf, true); 116 } 117 101 118 function set_template_dir($dir) 102 119 { 103 $modeling = $this->get_themeconf('modeling'); 104 if (!defined('IN_ADMIN') and ($modeling !== false)) 105 { // Modeling is active only on gallery side and never in admin 106 // Set the normal directory 107 $this->smarty->template_dir = array($dir); 108 // Modeling by theme parameter 109 $model = './template/' . $modeling; 110 if ( $model != './template/' and is_dir($model)) 111 { 112 $this->smarty->template_dir[] = $model; 113 } 114 // Default template directory 115 $this->smarty->template_dir[] = './template/default'; 116 } 117 else 118 { 119 $this->smarty->template_dir = $dir; 120 } 121 $real_dir = realpath($dir); 122 $compile_id = crc32( $real_dir===false ? $dir : $real_dir); 123 $this->smarty->compile_id = base_convert($compile_id, 10, 36 ); 120 $this->smarty->template_dir[] = $dir; 121 122 if (!isset($this->smarty->compile_id)) 123 { 124 $real_dir = realpath($dir); 125 $compile_id = crc32( $real_dir===false ? $dir : $real_dir); 126 $this->smarty->compile_id = base_convert($compile_id, 10, 36 ); 127 } 124 128 } 125 129 … … 197 201 function set_extents($filename_array, $dir='', $overwrite=true) 198 202 { 203 global $user; 204 199 205 if (!is_array($filename_array)) 200 206 { … … 221 227 222 228 if ((stripos(implode('',array_keys($_GET)), '/'.$param) !== false or $param == 'N/A') 223 and ( preg_match('/'.preg_quote($tpl,'/').'$/', $this->get_template_dir())or $tpl == 'N/A')229 and ($tpl == $user['theme'] or $tpl == 'N/A') 224 230 and (!isset($this->extents[$handle]) or $overwrite) 225 231 and file_exists($dir . $filename))
Note: See TracChangeset
for help on using the changeset viewer.