Class MTemplate

Description

Helper class for template document creation

The supported syntax is of the form

<NAMESPACE:value key="DATA_KEY" [function="FUNCTION_NAME"]>[DEFAULT_VALUE]</NAMESPACE:value> <NAMESPACE:value key="DATA_KEY" [function="FUNCTION_NAME"]/> <NAMESPACE:object key="OBJECT_KEY"/> <NAMESPACE:array key="DATA_KEY">[DATA_BLOCK]</NAMESPACE:array> <NAMESPACE:until key="FUNCTION_NAME">[DATA_BLOCK]</NAMESPACE:until>

  • author: Pascal (Meta) Havelange (havelangep@gmail.com)
  • copyright: &copy; 2007 All rights reserved

Located in /lib/mtemplate.inc.php (line 23)


	
			
Variable Summary
string $cache_file
string $cache_path
unknown_type $cache_validity
array $data
string $namespace
string $template
Method Summary
MTemplate __construct ([ $namespace = "mtemplate"])
void loadTemplate (string $path)
string transform ()
void useCache ([string $file = false], [integer $validity = 3600], [string $path = false])
Variables
string $cache_file = false (line 60)

Name of the cache file

  • access: protected
string $cache_path = false (line 52)

Filepath of the folder where to store the files generated by the cache system

  • access: protected
unknown_type $cache_validity = 3600 (line 68)

Validity of the cache file (in seconds)

  • access: protected
array $data = false (line 37)

Array of values

  • access: public
string $namespace = "mtemplate" (line 44)

Default namespace used by the template

  • access: public
string $template = false (line 30)

Template content

  • access: public
Methods
Constructor __construct (line 75)

Constructor

MTemplate __construct ([ $namespace = "mtemplate"])
  • $namespace
loadTemplate (line 404)

Load the template from a file

void loadTemplate (string $path)
  • string $path
transform (line 86)

Transform the loaded template, using the current array of data

  • return: The resulting document
string transform ()
useCache (line 128)

Enable or disable the cache system

void useCache ([string $file = false], [integer $validity = 3600], [string $path = false])
  • string $file: If FALSE, disable the cache system. Otherwise this must be the filename of the cachefile
  • integer $validity: Validity of the cache in seconds
  • string $path: Path where to store the cache files (If FALSE, the current folder will be used)

Documentation generated on Thu, 10 Dec 2009 15:21:31 +0100 by phpDocumentor 1.4.1