class template_compile
Extension of template class - Functions needed for compiling templates only.
psoTFX, phpBB Development Team - Completion of file caching, decompilation routines and implementation of conditionals/keywords and associated changes
The interface was inspired by PHPLib templates, and the template file (formats are quite similar)
The keyword/conditional implementation is currently based on sections of code from the Smarty templating engine (c) 2001 ispi of Lincoln, Inc. which is released (on its own and in whole) under the LGPL. Section 3 of the LGPL states that any code derived from an LGPL application may be relicenced under the GPL, this applies to this source
DEFINE directive inspired by a request by Cyberalien
Properties
| $template | ||
| $block_names | ||
| $block_else_level |
Methods
|
template_compile($template)
constuctor |
||
|
_tpl_load_file($handle, $store_in_db = false)
Load template source from file |
||
|
remove_php_tags($code)
Remove any PHP tags that do not belong, these regular expressions are derived from the ones that exist in zendlanguagescanner.l |
||
|
compile($code, $no_echo = false, $echo_var = '')
The all seeing all doing compile method. |
||
|
compile_var_tags($text_blocks)
Compile variables |
||
|
compile_tag_block($tag_args)
Compile blocks |
||
|
compile_tag_if($tag_args, $elseif)
Compile IF tags - much of this is from Smarty with some adaptions for our block level methods |
||
|
compile_tag_define($tag_args, $op)
Compile DEFINE tags |
||
|
compile_tag_include($tag_args)
Compile INCLUDE tag |
||
|
compile_tag_include_php($tag_args)
Compile INCLUDE_PHP tag |
||
|
_parse_is_expr($is_arg, $tokens)
parse expression This is from Smarty |
||
|
generate_block_varref($namespace, $varname, $echo = true, $defop = false)
Generates a reference to the given variable inside the given (possibly nested) block namespace. |
||
|
generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
Generates a reference to the array of data values for the given (possibly nested) block namespace. |
||
|
compile_write($handle, $data)
Write compiled file to cache directory |
Details
at line 49
public
template_compile($template)
constuctor
at line 58
public
_tpl_load_file($handle, $store_in_db = false)
Load template source from file
at line 94
public
remove_php_tags($code)
Remove any PHP tags that do not belong, these regular expressions are derived from the ones that exist in zendlanguagescanner.l
at line 110
public
compile($code, $no_echo = false, $echo_var = '')
The all seeing all doing compile method.
Parts are inspired by or directly from Smarty
at line 276
public
compile_var_tags($text_blocks)
Compile variables
at line 318
public
compile_tag_block($tag_args)
Compile blocks
at line 423
public
compile_tag_if($tag_args, $elseif)
Compile IF tags - much of this is from Smarty with some adaptions for our block level methods
at line 580
public
compile_tag_define($tag_args, $op)
Compile DEFINE tags
at line 633
public
compile_tag_include($tag_args)
Compile INCLUDE tag
at line 648
public
compile_tag_include_php($tag_args)
Compile INCLUDE_PHP tag
at line 658
public
_parse_is_expr($is_arg, $tokens)
parse expression This is from Smarty
at line 729
public
generate_block_varref($namespace, $varname, $echo = true, $defop = false)
Generates a reference to the given variable inside the given (possibly nested) block namespace.
This is a string of the form: ' . $this->tpldata['parent'][$parenti]['$child1'][$child1i]['$child2'][$child2_i]...['varname'] . ' It's ready to be inserted into an "echo" line in one of the templates. NOTE: expects a trailing "." on the namespace.
at line 754
public
generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
Generates a reference to the array of data values for the given (possibly nested) block namespace.
This is a string of the form: $this->tpldata['parent'][$parenti]['$child1'][$child1i]['$child2'][$child2_i]...['$childN']
If $includelastiterator is true, then [$childNi] will be appended to the form shown above. NOTE: does not expect a trailing "." on the blockname.
at line 792
public
compile_write($handle, $data)
Write compiled file to cache directory