Changeset 2716
- Timestamp:
- Oct 11, 2008, 7:21:52 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r2712 r2716 65 65 $this->smarty->register_modifier( 'translate', array('Template', 'mod_translate') ); 66 66 $this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') ); 67 $this->smarty->register_modifier( 'get_extent', array(&$this, 'get_extent') ); 67 68 $this->smarty->register_block('html_head', array(&$this, 'block_html_head') ); 68 69 $this->smarty->register_function('known_script', array(&$this, 'func_known_script') ); 69 $this->smarty->register_function('known_template', array(&$this, 'func_known_template') );70 70 $this->smarty->register_prefilter( array('Template', 'prefilter_white_space') ); 71 71 if ( $conf['compiled_template_cache_language'] ) … … 154 154 unset($this->files[$handle]); 155 155 } 156 elseif (isset($this->extents[$handle]))157 {158 $this->files[$handle] = $this->extents[$handle];159 }160 156 else 161 157 { 162 $this->files[$handle] = $ filename;158 $this->files[$handle] = $this->get_extent($filename, $handle); 163 159 } 164 160 } … … 209 205 } 210 206 return true; 207 } 208 209 /** return template extension if exists */ 210 function get_extent($filename='', $handle='') 211 { 212 if (isset($this->extents[$handle])) 213 { 214 $filename = $this->extents[$handle]; 215 } 216 return $filename; 211 217 } 212 218 … … 410 416 } 411 417 412 /**413 * This smarty "known_template" functions allows to include template414 * If extent[$params['id']] exists, include template extension415 * else include $params[$file]416 */417 function func_known_template($params, &$smarty )418 {419 if (!isset($params['file']))420 {421 $smarty->trigger_error("known_template: missing 'file' parameter");422 return;423 }424 425 if (isset($params['id']) and isset($this->extents[$params['id']]))426 {427 $file = $this->extents[$params['id']];428 }429 else430 {431 $file = $params['file'];432 }433 434 return $smarty->_smarty_include(array(435 'smarty_include_tpl_file' => $file,436 'smarty_include_vars' => array()437 ));438 }439 440 418 static function prefilter_white_space($source, &$smarty) 441 419 { -
trunk/template/yoga/menubar.tpl
r2712 r2716 5 5 <dl id="{$id}"> 6 6 {if not empty($block->template)} 7 { known_template id=$id file=$block->template}7 {include file=$block->template|@get_extent:$id } 8 8 {else} 9 9 {$block->raw_content|@default}
Note: See TracChangeset
for help on using the changeset viewer.