[ Index ]

PHP Cross Reference of phpBB 3.0 Beta 3

title

Body

[close]

/includes/ -> functions_template.php (summary)

(no description)

Copyright: (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
License: http://opensource.org/licenses/gpl-license.php GNU Public License
Version: $Id: functions_template.php,v 1.33 2006/11/10 13:48:48 acydburn Exp $
File Size: 706 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

template_compile:: (14 methods):
  template_compile()
  _tpl_load_file()
  remove_php_tags()
  compile()
  compile_var_tags()
  compile_tag_block()
  compile_tag_if()
  compile_tag_define()
  compile_tag_include()
  compile_tag_include_php()
  _parse_is_expr()
  generate_block_varref()
  generate_block_data_ref()
  compile_write()


Class: template_compile  - X-Ref

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

template_compile(&$template)   X-Ref
constuctor


_tpl_load_file($handle)   X-Ref
Load template source from file


remove_php_tags(&$code)   X-Ref
Straight-forward strategy: use PHP's tokenizer to escape everything that
looks like a PHP tag.

We open/close PHP tags at the beginning of the template to clearly indicate
that we are in HTML mode. If we find a PHP tag, we escape it then we reiterate
over the whole file. That can become quite slow if the file is stuffed with
<?php tags, but there's only so much we can do.

Known issue: templates need to be rechecked everytime the value of the php.ini
settings asp_tags or short_tags are changed

compile($code, $no_echo = false, $echo_var = '')   X-Ref
The all seeing all doing compile method. Parts are inspired by or directly from Smarty


compile_var_tags(&$text_blocks)   X-Ref
Compile variables


compile_tag_block($tag_args)   X-Ref
Compile blocks


compile_tag_if($tag_args, $elseif)   X-Ref
Compile IF tags - much of this is from Smarty with
some adaptions for our block level methods


compile_tag_define($tag_args, $op)   X-Ref
Compile DEFINE tags


compile_tag_include($tag_args)   X-Ref
Compile INCLUDE tag


compile_tag_include_php($tag_args)   X-Ref
Compile INCLUDE_PHP tag


_parse_is_expr($is_arg, $tokens)   X-Ref
parse expression
This is from Smarty


generate_block_varref($namespace, $varname, $echo = true, $defop = false)   X-Ref
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.


generate_block_data_ref($blockname, $include_last_iterator, $defop = false)   X-Ref
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.

compile_write(&$handle, $data)   X-Ref
Write compiled file to cache directory




Generated: Wed Nov 22 00:35:05 2006 Cross-referenced by PHPXref 0.6