Class template_compile

Description

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

Located in /includes/functions_template.php (line 38)


	
			
Variable Summary
Method Summary
 template_compile template_compile ( &$template)
 void compile ( $code, [ $no_echo = false], [ $echo_var = ''])
 void compile_tag_block ( $tag_args)
 void compile_tag_define ( $tag_args,  $op)
 void compile_tag_if ( $tag_args,  $elseif)
 void compile_tag_include ( $tag_args)
 void compile_tag_include_php ( $tag_args)
 void compile_var_tags ( &$text_blocks)
 void compile_write ( $handle,  $data)
 void generate_block_data_ref ( $blockname,  $include_last_iterator, [ $defop = false])
 void generate_block_varref ( $namespace,  $varname, [ $echo = true], [ $defop = false])
 void remove_php_tags ( &$code)
 void _parse_is_expr ( $is_arg,  $tokens)
 void _tpl_load_file ( $handle, [ $store_in_db = false])
Variables
mixed $block_else_level = array() (line 44)
mixed $block_names = array() (line 43)
mixed $template (line 40)
Methods
Constructor template_compile (line 49)

constuctor

template_compile template_compile ( &$template)
  • &$template
compile (line 110)

The all seeing all doing compile method. Parts are inspired by or directly from Smarty

  • access: private
void compile ( $code, [ $no_echo = false], [ $echo_var = ''])
  • $code
  • $no_echo
  • $echo_var
compile_tag_block (line 277)

Compile blocks

  • access: private
void compile_tag_block ( $tag_args)
  • $tag_args
compile_tag_define (line 539)

Compile DEFINE tags

  • access: private
void compile_tag_define ( $tag_args,  $op)
  • $tag_args
  • $op
compile_tag_if (line 382)

Compile IF tags - much of this is from Smarty with

some adaptions for our block level methods

  • access: private
void compile_tag_if ( $tag_args,  $elseif)
  • $tag_args
  • $elseif
compile_tag_include (line 592)

Compile INCLUDE tag

  • access: private
void compile_tag_include ( $tag_args)
  • $tag_args
compile_tag_include_php (line 601)

Compile INCLUDE_PHP tag

  • access: private
void compile_tag_include_php ( $tag_args)
  • $tag_args
compile_var_tags (line 235)

Compile variables

  • access: private
void compile_var_tags ( &$text_blocks)
  • &$text_blocks
compile_write (line 745)

Write compiled file to cache directory

  • access: private
void compile_write ( $handle,  $data)
  • $handle
  • $data
generate_block_data_ref (line 707)

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'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']

If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. NOTE: does not expect a trailing "." on the blockname.

  • access: private
void generate_block_data_ref ( $blockname,  $include_last_iterator, [ $defop = false])
  • $blockname
  • $include_last_iterator
  • $defop
generate_block_varref (line 682)

Generates a reference to the given variable inside the given (possibly nested) block namespace. This is a string of the form: ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$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.

  • access: private
void generate_block_varref ( $namespace,  $varname, [ $echo = true], [ $defop = false])
  • $namespace
  • $varname
  • $echo
  • $defop
remove_php_tags (line 94)

Remove any PHP tags that do not belong, these regular expressions are derived from

the ones that exist in zend_language_scanner.l

  • access: private
void remove_php_tags ( &$code)
  • &$code
_parse_is_expr (line 611)

parse expression

This is from Smarty

  • access: private
void _parse_is_expr ( $is_arg,  $tokens)
  • $is_arg
  • $tokens
_tpl_load_file (line 58)

Load template source from file

  • access: private
void _tpl_load_file ( $handle, [ $store_in_db = false])
  • $handle
  • $store_in_db

Documentation generated on Tue, 26 Aug 2008 08:34:05 +0200 by phpDocumentor 1.4.2