Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

PHPTAL_Template Class Reference

Inheritance diagram for PHPTAL_Template:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PHPTAL_Template ($file, $repository=false, $cache_dir=false)
 setOutputMode ($mode)
 setAll ($hash)
 set ($name, $value)
 setRef ($name, &$value)
getContext ()
 setContext (&$ctx)
 setCacheManager (&$mngr)
getCacheManager ()
 setTranslator (&$tr)
getTranslator ()
 fileExists ()
 isValid ()
 addSourceResolver (&$resolver)
 addInputFilter (&$filter)
 addOutputFilter (&$filter)
 realpath ($file=false)
 setEncoding ($enc)
 getEncoding ()
 setParent (&$tpl)
 _prepare ()
 _generateCode ()
 _loadCachedCode ()
 _cacheCode ()
 _load ()
 execute ()
 _process ()
 _translate ($key)
 _setTranslateVar ($name, $value)

Public Attributes

 $_ctx
 $_code
 $_codeFile
 $_funcName
 $_sourceFile
 $_error = false
 $_repository = false
 $_cacheDir = false
 $_parent = false
 $_parentPath = false
 $_prepared = false
 $_cacheManager
 $_outputMode = PHPTAL_XHTML
 $_inputFilters
 $_outputFilters
 $_resolvers
 $_locator
 $_headers = false
 $_translator
 $_encoding = 'UTF-8'

Constructor & Destructor Documentation

PHPTAL_Template::PHPTAL_Template file,
repository = false,
cache_dir = false
 

Template object constructor.

Parameters:
string $file -- The source file name
string $repository optional -- Your templates root.
string $cache_dir optional -- Intermediate php code repository.

Definition at line 59 of file Template.php.


Member Function Documentation

PHPTAL_Template::_cacheCode  ) 
 

Cache generated php code.

private

Definition at line 439 of file Template.php.

Referenced by _load().

PHPTAL_Template::_generateCode  ) 
 

Generate php code from template source

private

Exceptions:
PHPTALParseException 

Definition at line 394 of file Template.php.

References $i, and data.

Referenced by _load().

PHPTAL_Template::_load  ) 
 

Load or generate php code.

private

Definition at line 454 of file Template.php.

References _cacheCode(), _generateCode(), and _loadCachedCode().

Referenced by _process(), and PHPTAL_Macro::_process().

PHPTAL_Template::_loadCachedCode  ) 
 

Load cached php code

private

Definition at line 428 of file Template.php.

Referenced by _load().

PHPTAL_Template::_prepare  ) 
 

Prepare template execution.

private

Definition at line 374 of file Template.php.

References PHPTAL_MARK.

Referenced by execute(), and PHPTAL_Macro::execute().

PHPTAL_Template::_process  ) 
 

Really load/parse/execute the template and process output filters.

This method is called by cache manager to retrieve the real template execution value.

IMPORTANT : The result is post-filtered here !

Returns:
string private

Reimplemented in PHPTAL_Macro.

Definition at line 513 of file Template.php.

References $i, $res, _load(), and PHPTAL_POST_FILTER.

PHPTAL_Template::_setTranslateVar name,
value
 

Definition at line 553 of file Template.php.

References _setTranslateVar(), and name.

Referenced by _setTranslateVar().

PHPTAL_Template::_translate key  ) 
 

Definition at line 548 of file Template.php.

References _translate().

Referenced by _translate().

PHPTAL_Template::addInputFilter &$  filter  ) 
 

Add filter to this template input filters list.

Parameters:
PHPTAL_Filter $filter A filter which will be invoked on template source.

Definition at line 257 of file Template.php.

References addInputFilter().

Referenced by addInputFilter().

PHPTAL_Template::addOutputFilter &$  filter  ) 
 

Add an output filter to this template output filters list.

Parameters:
PHPTAL_Filter $filter A filter which will be invoked on template output.

Definition at line 268 of file Template.php.

References addOutputFilter().

Referenced by addOutputFilter().

PHPTAL_Template::addSourceResolver &$  resolver  ) 
 

Add a source resolver to the template.

Parameters:
PHPTAL_SourceResolver $resolver The source resolver.

Definition at line 246 of file Template.php.

References addSourceResolver().

Referenced by addSourceResolver().

PHPTAL_Template::execute  ) 
 

Execute template with prepared context.

This method execute the template file and returns the produced string.

Returns:
string
Exceptions:
 

Reimplemented in PHPTAL_Macro.

Definition at line 490 of file Template.php.

References _prepare().

PHPTAL_Template::fileExists  ) 
 

Test if the template file exists.

Deprecated:
use isValid() instead
Returns:
boolean

Definition at line 203 of file Template.php.

References isValid().

& PHPTAL_Template::getCacheManager  ) 
 

Retrieve the cache manager used in this template.

Returns:
PHPTAL_Cache

Definition at line 173 of file Template.php.

& PHPTAL_Template::getContext  ) 
 

Retrieve template context object.

Returns:
PHPTAL_Context

Definition at line 142 of file Template.php.

PHPTAL_Template::getEncoding  ) 
 

Retrieve the template result encoding.

Returns:
string

Definition at line 344 of file Template.php.

& PHPTAL_Template::getTranslator  ) 
 

The translator used by this template.

Returns:
PHPTAL_I18N

Definition at line 193 of file Template.php.

PHPTAL_Template::isValid  ) 
 

Test if the template resource exists.

Returns:
boolean

Definition at line 213 of file Template.php.

References $i.

Referenced by fileExists(), and realpath().

PHPTAL_Template::realpath file = false  ) 
 

Retrieve the source template real path.

This method store its result internally if no $file attribute is specified (work on template internals).

If a file name is specified, this method will try to locate it exploring current path (PWD), the current template location, the repository and parent template location.

Parameters:
string $file optional some file name to locate.
Exceptions:
FileNotFound 
Returns:
string

Definition at line 289 of file Template.php.

References $i, isValid(), and realpath().

Referenced by realpath().

PHPTAL_Template::set name,
value
 

Set a template context value.

Parameters:
string $key -- The context key
mixed $value -- The context value

Definition at line 121 of file Template.php.

References name, and set().

Referenced by set().

PHPTAL_Template::setAll hash  ) 
 

Replace template context with specified hashtable.

Parameters:
hash hashtable -- Associative array.

Definition at line 110 of file Template.php.

References setAll().

Referenced by setAll().

PHPTAL_Template::setCacheManager &$  mngr  ) 
 

Set the cache manager to use for Template an Macro calls.

Parameters:
PHPTAL_Cache $mngr -- Cache object that will be used to cache template and macros results.

Definition at line 163 of file Template.php.

References setCacheManager().

Referenced by setCacheManager().

PHPTAL_Template::setContext &$  ctx  ) 
 

Set the template context object.

Parameters:
PHPTAL_Context $ctx -- The context object

Definition at line 152 of file Template.php.

References setContext().

Referenced by setContext().

PHPTAL_Template::setEncoding enc  ) 
 

Set the template result encoding.

Changing this encoding will change htmlentities behaviour.

Example:

$tpl->setEncoding('ISO-8859-1");

See http://fr2.php.net/manual/en/function.htmlentities.php for a list of supported encodings.

Parameters:
$enc string Template encoding

Definition at line 334 of file Template.php.

References setEncoding().

Referenced by setEncoding().

PHPTAL_Template::setOutputMode mode  ) 
 

Set template ouput type.

Default output is XHTML, so you'll have to call this method only for specific xml documents with PHPTAL_XML parameter.

Parameters:
int $mode -- output mode (PHPTAL_XML) as default system use XHTML

Definition at line 100 of file Template.php.

References setOutputMode().

Referenced by setOutputMode().

PHPTAL_Template::setParent &$  tpl  ) 
 

Set the called template. (internal)

package

Definition at line 358 of file Template.php.

References setParent().

Referenced by setParent().

PHPTAL_Template::setRef name,
&$  value
 

Set a template context value by reference.

Parameters:
string $name -- The template context key
mixed $value -- The template context value

Definition at line 132 of file Template.php.

References name, and setRef().

Referenced by setRef().

PHPTAL_Template::setTranslator &$  tr  ) 
 

Set the I18N implementation to use in this template.

Parameters:
PHPTAL_I18N $tr -- I18N implementation

Definition at line 183 of file Template.php.

References setTranslator().

Referenced by setTranslator().


Member Data Documentation

PHPTAL_Template::$_cacheDir = false
 

Definition at line 33 of file Template.php.

PHPTAL_Template::$_cacheManager
 

Definition at line 37 of file Template.php.

PHPTAL_Template::$_code
 

Definition at line 27 of file Template.php.

PHPTAL_Template::$_codeFile
 

Definition at line 28 of file Template.php.

PHPTAL_Template::$_ctx
 

Definition at line 26 of file Template.php.

PHPTAL_Template::$_encoding = 'UTF-8'
 

Definition at line 50 of file Template.php.

PHPTAL_Template::$_error = false
 

Definition at line 31 of file Template.php.

PHPTAL_Template::$_funcName
 

Definition at line 29 of file Template.php.

PHPTAL_Template::$_headers = false
 

Definition at line 46 of file Template.php.

PHPTAL_Template::$_inputFilters
 

Definition at line 41 of file Template.php.

PHPTAL_Template::$_locator
 

Definition at line 44 of file Template.php.

PHPTAL_Template::$_outputFilters
 

Definition at line 42 of file Template.php.

PHPTAL_Template::$_outputMode = PHPTAL_XHTML
 

Definition at line 39 of file Template.php.

PHPTAL_Template::$_parent = false
 

Definition at line 34 of file Template.php.

PHPTAL_Template::$_parentPath = false
 

Definition at line 35 of file Template.php.

PHPTAL_Template::$_prepared = false
 

Definition at line 36 of file Template.php.

PHPTAL_Template::$_repository = false
 

Definition at line 32 of file Template.php.

PHPTAL_Template::$_resolvers
 

Definition at line 43 of file Template.php.

PHPTAL_Template::$_sourceFile
 

Definition at line 30 of file Template.php.

PHPTAL_Template::$_translator
 

Definition at line 48 of file Template.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 29 23:41:00 2004 for Mediawiki by doxygen 1.3.7