[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/contrib/ -> template_file_cache.php (summary)

(no description)

File Size: 535 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Template:: (14 methods):
  Template()
  destroy()
  set_rootdir()
  set_filenames()
  pparse()
  assign_var_from_handle()
  assign_block_vars()
  assign_vars()
  assign_var()
  make_filename()
  loadfile()
  compile()
  generate_block_varref()
  generate_block_data_ref()


Class: Template  - X-Ref

Template class. By Nathan Codding of the phpBB group.
The interface was originally inspired by PHPLib templates,
and the template file formats are quite similar.

Updated 9th June 2003 - psoTFX
Backported various aspects of 2.2 template class

Template($root = '.')   X-Ref
Constructor. Simply sets the root dir.


destroy()   X-Ref
Destroys this template object. Should be called when you're done with it, in order
to clear out the template data so you can load/parse a new template set.


set_rootdir($dir)   X-Ref
Sets the template root directory for this Template object.


set_filenames($filename_array)   X-Ref
Sets the template filenames for handles. $filename_array
should be a hash of handle => filename pairs.


pparse($handle)   X-Ref
Load the file for the handle, compile the file,
and run the compiled code. This will print out
the results of executing the template.


assign_var_from_handle($varname, $handle)   X-Ref
Inserts the uncompiled code for $handle as the
value of $varname in the root-level. This can be used
to effectively include a template in the middle of another
template.
Note that all desired assignments to the variables in $handle should be done
BEFORE calling this function.


assign_block_vars($blockname, $vararray)   X-Ref
Block-level variable assignment. Adds a new block iteration with the given
variable assignments. Note that this should only be called once per block
iteration.


assign_vars($vararray)   X-Ref
Root-level variable assignment. Adds to current assignments, overriding
any existing variable assignment with the same name.


assign_var($varname, $varval)   X-Ref
Root-level variable assignment. Adds to current assignments, overriding
any existing variable assignment with the same name.


make_filename($filename)   X-Ref
Generates a full path+filename for the given filename, which can either
be an absolute name, or a name relative to the rootdir for this Template
object.


loadfile($handle)   X-Ref
If not already done, load the file for the given handle and populate
the uncompiled_code[] hash with its code. Do not compile.


compile($code, $do_not_echo = false, $retvar = '')   X-Ref
Compiles the given string of code, and returns
the result in a string.
If "do_not_echo" is true, the returned code will not be directly
executable, but can be used as part of a variable assignment
for use in assign_code_from_handle().


generate_block_varref($namespace, $varname, $concat)   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)   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.



Generated: Mon Jan 14 19:21:40 2013 Cross-referenced by PHPXref 0.7.1