Changeset 2058 for trunk/include/template.php
- Timestamp:
- Jul 10, 2007, 7:09:05 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/template.php
r2036 r2058 156 156 if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) 157 157 { 158 trigger_action('loc_be fore_tpl_pparse', $handle, array(&$this));158 trigger_action('loc_begin_tpl_pparse', $handle, array(&$this)); 159 159 // Actually compile the code now. 160 160 $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle]); … … 180 180 if (!isset($this->compiled_code[$handle]) || empty($this->compiled_code[$handle])) 181 181 { 182 trigger_action('loc_be fore_tpl_parse', $handle, array(&$this));182 trigger_action('loc_begin_tpl_parse', $handle, array(&$this)); 183 183 // Actually compile the code now. 184 184 $this->compiled_code[$handle] = $this->compile($this->uncompiled_code[$handle], true, '_str'); … … 215 215 function assign_var_from_handle($varname, $handle) 216 216 { 217 if (!$this->loadfile($handle)) 218 { 219 die("Template->assign_var_from_handle(): Couldn't load template file for handle $handle"); 220 } 221 222 trigger_action('loc_before_tpl_assign_var_from_handle', $handle, array(&$this)); 223 // Compile it, with the "no echo statements" option on. 224 $_str = ""; 225 $code = $this->compile($this->uncompiled_code[$handle], true, '_str'); 226 227 // evaluate the variable assignment. 228 eval($code); 229 // assign the value of the generated variable to the given varname. 230 $this->assign_var($varname, $_str); 231 217 trigger_action('loc_begin_tpl_assign_var_from_handle', $varname, $handle, array(&$this)); 218 $this->assign_var($varname, $this->parse($handle, true)); 219 return true; 220 } 221 222 /** 223 * Concat the uncompiled code for $handle as the value of $varname in the 224 * root-level. This can be used to effectively include a template in the 225 * middle of another template. 226 * 227 * Note that all desired assignments to the variables in $handle should be 228 * done BEFORE calling this function. 229 */ 230 function concat_var_from_handle($varname, $handle) 231 { 232 trigger_action('loc_begin_tpl_concat_var_from_handle', $varname, $handle, array(&$this)); 233 $this->concat_var($varname, $this->parse($handle, true)); 232 234 return true; 233 235 }
Note: See TracChangeset
for help on using the changeset viewer.