Changeset 11753 for trunk/include/template.class.php
- Timestamp:
- Jul 15, 2011, 8:56:20 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.class.php
r11122 r11753 116 116 $this->smarty->register_compiler_function('get_combined_css', array(&$this, 'func_get_combined_css') ); 117 117 $this->smarty->register_block('footer_script', array(&$this, 'block_footer_script') ); 118 $this->smarty->register_function('known_script', array(&$this, 'func_known_script') );119 118 $this->smarty->register_prefilter( array('Template', 'prefilter_white_space') ); 120 119 if ( $conf['compiled_template_cache_language'] ) … … 532 531 } 533 532 534 /** 535 * This smarty "known_script" functions allows to insert well known java scripts 536 * such as prototype, jquery, etc... only once. Examples: 537 * {known_script id="jquery" src="{$ROOT_URL}template-common/lib/jquery.packed.js"} 538 */ 539 function func_known_script($params, &$smarty ) 540 { 541 if (!isset($params['id'])) 542 { 543 $smarty->trigger_error("known_script: missing 'id' parameter"); 544 return; 545 } 546 $id = $params['id']; 547 trigger_error("known_script is deprecated $id ".@$params['src'], E_USER_WARNING); 548 if ('jquery'==$id) 549 { 550 $this->scriptLoader->add($id, 0, array(), null); 551 return; 552 } 553 if (! isset( $this->known_scripts[$id] ) ) 554 { 555 if (!isset($params['src'])) 556 { 557 $smarty->trigger_error("known_script: missing 'src' parameter"); 558 return; 559 } 560 $this->known_scripts[$id] = $params['src']; 561 $content = '<script type="text/javascript" src="'.$params['src'].'"></script>'; 562 if (isset($params['now']) and $params['now'] and empty($this->output) ) 563 { 564 return $content; 565 } 566 $repeat = false; 567 $this->block_html_head(null, $content, $smarty, $repeat); 568 } 569 } 570 571 /** 533 /** 572 534 * combine_script smarty function allows inclusion of a javascript file in the current page. 573 535 * The engine will combine several js files into a single one in order to reduce the number of
Note: See TracChangeset
for help on using the changeset viewer.