fititnt - Especialista e Desenvolvedor Joomla! Visit fititnt.org, and look for some extension or more Joomla Framework info patTemplate
[ class tree: patTemplate ] [ index: patTemplate ] [ all elements ]

Class: patTemplate

Source Location: /includes/patTemplate/patTemplate.php

Class patTemplate

Class Overview
Descendants
Child Class Description
patTemplate_Compiler Compiler for patTemplate

[ Top ]
Property Summary
array   $_defaultAttributes   default attributes for new templates
array   $_discoveredPlaceholders   placeholders, that have been discovered
string   $_endTag   end tag
array   $_globals   stores all global variables
array   $_inputFilters   input filters that should be used
array   $_moduleDirs   directories, where modules can be stored
array   $_modules   loaded modules
array   $_options   options for patTemplate
array   $_outputFilters   output filters that should be used
string   $_root   stores the name of the first template that has been found
string   $_startTag   start tag
array   $_systemVars   standard system vars that identify pat tools
array   $_templateList   stores all template names
array   $_templates   stores all template data
array   $_tmplCache   template cache, that should be used
array   $_vars   stores all local variables

[ Top ]
Method Summary
patTemplate   patTemplate()   Create a new patTemplate instance.
boolean   addGlobalVar()   Adds a global variable
boolean   addGlobalVars()   Adds several global variables
void   addModuleDir()   add a directory where patTemplate should search for modules.
void   addObject()   Adds an object to a template
void   addRows()   Adds several rows of variables to a template
void   addVar()   add a variable to a template
void   addVars()   Adds several variables to a template
boolean   applyInputFilter()   enable an input filter
string   applyInputFilters()   apply input filters that have been set
boolean   applyOutputFilter()   enable an output filter
void   clearAllTemplates()   clears all templates
void   clearAttribute()   Clears an attribute of a template
boolean   clearGlobalVar()   Clears a global variable
boolean   clearGlobalVars()   Clears all global variables
void   clearTemplate()   clears a parsed Template
boolean   clearVar()   clear the value of a variable
boolean   clearVars()   Clear all variables in a template
boolean   displayParsedTemplate()   displays a parsed Template
void   dump()   Displays useful information about all or named templates
boolean   exists()   checks wether a template exists
void   freeAllTemplates()   frees all templates
void   freeTemplate()   frees a template
mixed   getAttribute()   Gets an attribute of a template
array   getAttributes()   Get all attributes of a template
return   getDefaultAttributes()   get default attributes
string   getEndTag()   get end tag for variables
array   getGlobalVars()   get all global variables
string   getIncludePath()   get the include path
string|array   getNamespace()   gets namespace of patTemplate tags
array   getObjectVars()   get the vars from an object
mixed   getOption()   gets an option
string   getParsedTemplate()   returns a parsed Template
mixed   getRoot()   gets name of root base for the templates
string   getStartTag()   get start tag for variables
string   getVar()   get the value of a variable
object   &loadModule()   loads a patTemplate module
boolean   loadTemplate()   load a template that had autoload="off"
boolean   loadTemplateFromInput()   open any input and load content into template
boolean   moduleExists()   checks whether a module exists.
string   parseIntoVar()   parse a template and push the result into a variable of any other template
void   parseTemplate()   parses a template
void   placeholderExists()   checks, whether a placeholder exists in a template
void   prepareTemplate()   Prepare a template
true,   readTemplatesFromFile()   open a file and parse for patTemplate tags
boolean   readTemplatesFromInput()   open any input and parse for patTemplate tags
void   setAttribute()   Sets an attribute of a template
void   setAttributes()   Sets several attribute of a template
void   setBasedir()   sets name of directory where templates are stored
void   setDefaultAttribute()   set default attribute
void   setDefaultAttributes()   set default attributes
void   setNamespace()   sets namespace of patTemplate tags
void   setOption()   sets an option
void   setRoot()   sets root base for the template
boolean   setTags()   set the start and end tag for variables
boolean   setType()   set the type for the templates
boolean   useTemplateCache()   enable a template cache
boolean   _applyModifers()   apply variable modifiers
boolean   _fetchTemplate()   fetch plain template
boolean   _fetchVariables()   fetch variables for a template
void   _getConditionValue()   fetch the value of a condition variable
array   _getDependencies()   get _all_ dependencies of a template, regardless of the subtemplates
void   _handleUnusedVars()   handle all unused variables in a template
boolean   _hasVariables()   check, whether a template contains variables
boolean   _initTemplate()   Initialize a template
array|boolean   _loadTemplatesFromCache()   load from template cache
void   _parseDependencies()   parse all dependencies in a template
boolean   _parseGlobals()   parse global variables in the template
void   _parseVariables()   parse all variables in a template
string   __toString()   Convert the template to its string representation.

[ Top ]
Properties
array   $_defaultAttributes = array(
'type' => 'standard',
'visibility' => 'visible',
'loop' => 1,
'unusedvars' => 'strip',
'whitespace' => 'keep',
'autoclear' => 'off',
'autoload' => 'on'
)
[line 88]

default attributes for new templates

API Tags:
Access:  private


[ Top ]
array   $_discoveredPlaceholders = array() [line 221]

placeholders, that have been discovered

API Tags:
Access:  private


[ Top ]
string   $_endTag = '}' [line 131]

end tag

API Tags:
Access:  private


[ Top ]
array   $_globals = array() [line 173]

stores all global variables

API Tags:
Access:  private


[ Top ]
array   $_inputFilters = array() [line 205]

input filters that should be used

API Tags:
Access:  private


[ Top ]
array   $_moduleDirs = array() [line 152]

directories, where modules can be stored

API Tags:
Access:  private


[ Top ]
array   $_modules = array() [line 145]

loaded modules

Modules are:

  • Readers
  • Caches
  • Variable modifiers
  • Filters

API Tags:
Access:  private


[ Top ]
array   $_options = array(
'startTag' => '{',
'endTag' => '}',
'root' => array('__default' => '.'),'namespace'=>'patTemplate','maintainBc'=>true,'defaultFunction'=>false)
[line 108]

options for patTemplate

Currently the following options are implemented:

  • maintainBc defines, whether patTemplate should be backwards compatible. This means, that you may use 'default' and 'empty' for subtemplates.

API Tags:
Access:  private


[ Top ]
array   $_outputFilters = array() [line 197]

output filters that should be used

API Tags:
Access:  private


[ Top ]
string   $_root [line 189]

stores the name of the first template that has been found

API Tags:
Access:  private


[ Top ]
string   $_startTag = '{' [line 123]

start tag

API Tags:
Access:  private


[ Top ]
array   $_systemVars = array(
'appName' => 'patTemplate',
'appVersion' => '3.1.0',
'author' => array(
'Stephan Schmidt <schst@php.net>'
))
[line 75]

standard system vars that identify pat tools


[ Top ]
array   $_templateList = array() [line 159]

stores all template names

API Tags:
Access:  private


[ Top ]
array   $_templates = array() [line 166]

stores all template data

API Tags:
Access:  private


[ Top ]
array   $_tmplCache = null [line 213]

template cache, that should be used

API Tags:
Access:  private


[ Top ]
array   $_vars = array() [line 180]

stores all local variables

API Tags:
Access:  private


[ Top ]
Methods
Constructor patTemplate  [line 236]

  patTemplate patTemplate( [string $type = 'html']  )

Create a new patTemplate instance.

The constructor accepts the type of the templates as sole parameter. You may choose one of:

  • html (default)
  • tex
The type influences the tags you are using in your templates.

Parameters:
string   $type:  type (either html or tex)

API Tags:
Access:  public


[ Top ]
addGlobalVar  [line 864]

  boolean addGlobalVar( string $varname, string $value  )

Adds a global variable

Global variables are valid in all templates of this object. A global variable has to be scalar, it will be converted to a string.

Parameters:
string   $varname:  name of the global variable
string   $value:  value of the variable

API Tags:
Return:  true on success
See:  patTemplate::addGlobalVars(), patTemplate::addVar(), patTemplate::addVars(), patTemplate::addRows()
Access:  public


[ Top ]
addGlobalVars  [line 914]

  boolean addGlobalVars( array $variables, [string $prefix = '']  )

Adds several global variables

Global variables are valid in all templates of this object.

$variables is an associative array, containing name/value pairs of the variables.

Parameters:
array   $variables:  array containing the variables
string   $prefix:  prefix for variable names

API Tags:
Return:  true on success
See:  patTemplate::addGlobalVar(), patTemplate::addVar(), patTemplate::addVars(), patTemplate::addRows()
Access:  public


[ Top ]
addModuleDir  [line 453]

  void addModuleDir( string $moduleType, string|array $dir  )

add a directory where patTemplate should search for modules.

You may either pass a string or an array of directories.

patTemplate will be searching for a module in the same order you added them. If the module cannot be found in the custom folders, it will look in patTemplate/$moduleType.

Parameters:
string   $moduleType:  module type
string|array   $dir:  directory or directories to search.

API Tags:
Access:  public


[ Top ]
addObject  [line 812]

  void addObject( string $template, object|array $object, [string $prefix = ''], [boolean $ignorePrivate = false]  )

Adds an object to a template

All properties of the object will be available as template variables.

Parameters:
string   $template:  name of the template
object|array   $object:  object or array of objects
string   $prefix:  prefix for all variable names
boolean   $ignorePrivate:  ignore private properties (starting with _)

API Tags:
See:  patTemplate::addVar(), patTemplate::addRows(), patTemplate::addGlobalVar(), patTemplate::addGlobalVars()
Access:  public


[ Top ]
addRows  [line 780]

  void addRows( string $template, array $rows, [string $prefix = '']  )

Adds several rows of variables to a template

Each Template can have an unlimited amount of its own variables Can be used to add a database result as variables to a template

Parameters:
string   $template:  name of the template
array   $rows:  array containing assotiative arrays with variable/value pairs
string   $prefix:  prefix for all variable names

API Tags:
See:  patTemplate::addVar(), patTemplate::addVars(), patTemplate::addGlobalVar(), patTemplate::addGlobalVars()
Access:  public


[ Top ]
addVar  [line 625]

  void addVar( string $template, string $varname, mixed $value  )

add a variable to a template

A variable may also be an indexed array, but _not_ an associative array!

Parameters:
string   $template:  name of the template
string   $varname:  name of the variable
mixed   $value:  value of the variable

API Tags:
Access:  public


[ Top ]
addVars  [line 720]

  void addVars( string $template, array $variables, [string $prefix = '']  )

Adds several variables to a template

Each Template can have an unlimited amount of its own variables $variables has to be an assotiative array containing variable/value pairs

Parameters:
string   $template:  name of the template
array   $variables:  assotiative array of the variables
string   $prefix:  prefix for all variable names

API Tags:
See:  patTemplate::addVar(), patTemplate::addRows(), patTemplate::addGlobalVar(), patTemplate::addGlobalVars()
Access:  public


[ Top ]
applyInputFilter  [line 1019]

  boolean applyInputFilter( string $filter, [array $params = array()]  )

enable an input filter

input filters are used to modify the template stream before it is split into smaller templates-

Parameters:
string   $filter:  name of the input filter
array   $params:  parameters for the input filter

API Tags:
Return:  true on success, patError otherwise
Access:  public


[ Top ]
applyInputFilters  [line 2570]

  string applyInputFilters( string $template  )

apply input filters that have been set

This is being called by the readers.

Parameters:
string   $template:  template

API Tags:
Return:  filtered templeta
Access:  public


[ Top ]
applyOutputFilter  [line 986]

  boolean applyOutputFilter( string $filter, [array $params = array()], [ $template = null]  )

enable an output filter

Output filters are used to modify the template result before it is sent to the browser.

They are applied, when displayParsedTemplate() is called.

Parameters:
string   $filter:  name of the output filter
array   $params:  parameters for the output filter
   $template: 

API Tags:
Return:  true on success, patError otherwise
Access:  public


[ Top ]
clearAllTemplates  [line 2398]

  void clearAllTemplates( )

clears all templates


API Tags:
Access:  public
Uses:  patTemplate::clearTemplate()


[ Top ]
clearAttribute  [line 577]

  void clearAttribute( string $template, string $attribute  )

Clears an attribute of a template

supported attributes: visibilty, loop, parse, unusedvars

Parameters:
string   $template:  name of the template
string   $attribute:  name of the attribute

API Tags:
See:  patTemplate::setAttribute(), patTemplate::setAttributes(), patTemplate::getAttribute()
Access:  public


[ Top ]
clearGlobalVar  [line 878]

  boolean clearGlobalVar( string $varname  )

Clears a global variable

Parameters:
string   $varname:  name of the global variable

API Tags:
Return:  true on success
See:  patTemplate::clearVar(), patTemplate::clearVars(), patTemplate::clearGlobalVars()
Access:  public


[ Top ]
clearGlobalVars  [line 895]

  boolean clearGlobalVars( )

Clears all global variables


API Tags:
Return:  true on success
See:  patTemplate::clearVar(), patTemplate::clearVars(), patTemplate::clearGlobalVar()
Access:  public


[ Top ]
clearTemplate  [line 2360]

  void clearTemplate( string $name, [boolean $recursive = false]  )

clears a parsed Template

Parsed Content, variables and the loop attribute are cleared

If you will not be using this template anymore, then you should call freeTemplate()

Parameters:
string   $name:  name of the template
boolean   $recursive:  set this to true to clear all child templates, too

API Tags:
See:  patTemplate::freeTemplate()
See:  patTemplate::clearAllTemplates()
Access:  public
Usedby:  patTemplate::clearAllTemplates()


[ Top ]
clearVar  [line 685]

  boolean clearVar( string $template, string $varname  )

clear the value of a variable

Parameters:
string   $template:  name of the template
string   $varname:  name of the variable

API Tags:
See:  patTemplate::clearVars(), patTemplate::clearTemplate()
Access:  public


[ Top ]
clearVars  [line 757]

  boolean clearVars( string $template  )

Clear all variables in a template

This clears only variables, but does

Parameters:
string   $template:  name of the template

API Tags:
See:  patTemplate::clearVar(), patTemplate::clearTemplate()
Access:  public


[ Top ]
displayParsedTemplate  [line 2298]

  boolean displayParsedTemplate( [string $name = null], [boolean $applyFilters = true]  )

displays a parsed Template

If the template has not been loaded, it will be loaded.

Parameters:
string   $name:  name of the template
boolean   $applyFilters:  whether to apply output filters

API Tags:
Return:  true on success
See:  patTemplate::getParsedTemplate()
Access:  public


Redefined in descendants as:

[ Top ]
dump  [line 2509]

  void dump( [mixed $restrict = null], [string $dumper = 'Html']  )

Displays useful information about all or named templates

This method breaks BC, as it now awaits an array instead of unlimited parameters.

Parameters:
mixed   $restrict:  array of templates that should be dumped, or null if you want all templates to be dumped
string   $dumper:  dumper

API Tags:
Access:  public


[ Top ]
exists  [line 944]

  boolean exists( string $name  )

checks wether a template exists

Parameters:
string   $name:  name of the template

API Tags:
Return:  true, if the template exists, false otherwise
Access:  public


[ Top ]
freeAllTemplates  [line 2465]

  void freeAllTemplates( )

frees all templates

All memory consumed by the templates will be freed.


API Tags:
See:  patTemplate::freeTemplate()
Access:  public


[ Top ]
freeTemplate  [line 2420]

  void freeTemplate( string $name, [boolean $recursive = false]  )

frees a template

All memory consumed by the template will be freed.

Parameters:
string   $name:  name of the template
boolean   $recursive:  clear dependencies of the template

API Tags:
See:  patTemplate::freeAllTemplates()
Access:  public


[ Top ]
getAttribute  [line 553]

  mixed getAttribute( string $template, string $attribute  )

Gets an attribute of a template

supported attributes: visibilty, loop, parse, unusedvars

Parameters:
string   $template:  name of the template
string   $attribute:  name of the attribute

API Tags:
Return:  value of the attribute
See:  patTemplate::setAttribute(), patTemplate::setAttributes(), patTemplate::clearAttribute()
Access:  public


[ Top ]
getAttributes  [line 529]

  array getAttributes( string $template  )

Get all attributes of a template

Parameters:
string   $template:  name of the template

API Tags:
Return:  attributes
Access:  public


[ Top ]
getDefaultAttributes  [line 367]

  return getDefaultAttributes( )

get default attributes


API Tags:
Return:  default attributes
Access:  public


[ Top ]
getEndTag  [line 433]

  string getEndTag( )

get end tag for variables


API Tags:
Return:  end tag
Access:  public


[ Top ]
getGlobalVars  [line 932]

  array getGlobalVars( )

get all global variables


API Tags:
Return:  global variables
Access:  public


[ Top ]
getIncludePath  [line 2556]

  string getIncludePath( )

get the include path


API Tags:
Access:  public


[ Top ]
getNamespace  [line 333]

  string|array getNamespace( )

gets namespace of patTemplate tags


API Tags:
Return:  namespace(s)
Access:  public


[ Top ]
getObjectVars  [line 835]

  array getObjectVars( object $obj, [boolean $ignorePrivate = false]  )

get the vars from an object

Parameters:
object   $obj: 
boolean   $ignorePrivate:  ignore private properties (starting with _)

API Tags:
Access:  private


[ Top ]
getOption  [line 268]

  mixed getOption( string $option  )

gets an option

Parameters:
string   $option:  option to get

API Tags:
Return:  value of the option
Access:  public


[ Top ]
getParsedTemplate  [line 2260]

  string getParsedTemplate( [string $name = null], [boolean $applyFilters = false]  )

returns a parsed Template

If the template already has been parsed, it just returns the parsed template. If the template has not been loaded, it will be loaded.

Parameters:
string   $name:  name of the template
boolean   $applyFilters:  whether to apply output filters

API Tags:
Return:  Content of the parsed template
See:  patTemplate::displayParsedTemplate()
Access:  public


[ Top ]
getRoot  [line 307]

  mixed getRoot( [ $reader = '__default']  )

gets name of root base for the templates

Parameters:
   $reader: 

API Tags:
Return:  root base
Access:  public


[ Top ]
getStartTag  [line 422]

  string getStartTag( )

get start tag for variables


API Tags:
Return:  start tag
Access:  public


[ Top ]
getVar  [line 654]

  string getVar( string $template, string $varname  )

get the value of a variable

Parameters:
string   $template:  name of the template
string   $varname:  name of the variable

API Tags:
Return:  value of the variable, null if the variable is not set
Access:  public


[ Top ]
loadModule  [line 1365]

  object &loadModule( string $moduleType, string $moduleName, [array $params = array()], [ $new = false]  )

loads a patTemplate module

Modules are located in the patTemplate folder and include:

  • Readers
  • Caches
  • Variable Modifiers
  • Filters
  • Functions
  • Stats

Parameters:
string   $moduleType:  moduleType (Reader|TemplateCache|Modifier|OutputFilter|InputFilter)
string   $moduleName:  moduleName
array   $params:  parameters for the module
   $new: 

API Tags:
Access:  public


[ Top ]
loadTemplate  [line 1324]

  boolean loadTemplate( string $template  )

load a template that had autoload="off"

This is needed, if you change the source of a template and want to load it, after changing the attribute.

Parameters:
string   $template:  template name

API Tags:
Return:  true, if template could be loaded
Access:  public


[ Top ]
loadTemplateFromInput  [line 1285]

  boolean loadTemplateFromInput( string $input, [string $reader = 'File'], [string $options = null], [ $parseInto = false]  )

open any input and load content into template

Parameters:
string   $input:  name of the input (filename, shm segment, etc.)
string   $reader:  driver that is used as reader
string   $options:  name of the template that should be used as a container,
   $parseInto: 

API Tags:
Return:  true, if the template could be parsed, false otherwise
Access:  public


[ Top ]
moduleExists  [line 1447]

  boolean moduleExists( string $moduleType, string $moduleName  )

checks whether a module exists.

Modules are located in the patTemplate folder and include:

  • Readers
  • Caches
  • Variable Modifiers
  • Filters
  • Functions
  • Stats

Parameters:
string   $moduleType:  moduleType (Reader|TemplateCache|Modifier|OutputFilter|InputFilter)
string   $moduleName:  moduleName

API Tags:
Access:  public


[ Top ]
parseIntoVar  [line 2327]

  string parseIntoVar( string $srcTmpl, boolean $destTmpl, $var, [ $append = false]  )

parse a template and push the result into a variable of any other template

If the template already has been parsed, it will just be pushed into the variable. If the template has not been loaded, it will be loaded.

Parameters:
string   $srcTmpl:  name of the template
boolean   $destTmpl:  if set to true, the value will be appended to the value already stored.
   $var: 
   $append: 

API Tags:
Return:  Content of the parsed template
See:  patTemplate::addVar()
See:  patTemplate::getParsedTemplate()
Access:  public


[ Top ]
parseTemplate  [line 1480]

  void parseTemplate( string $template, [string $mode = 'w']  )

parses a template

Parses a template and stores the parsed content. mode can be "w" for write (delete already parsed content) or "a" for append (appends the new parsed content to the already parsed content)

Parameters:
string   $template:  name of the template
string   $mode:  mode for the parsing

API Tags:
Access:  public


[ Top ]
placeholderExists  [line 2588]

  void placeholderExists( string $placeholder, string $tmpl, [boolean $cached = true]  )

checks, whether a placeholder exists in a template

Parameters:
string   $placeholder:  name of the placeholder
string   $tmpl:  name of the template
boolean   $cached:  whether to use the cached result of a previous call

API Tags:
Access:  public


[ Top ]
prepareTemplate  [line 602]

  void prepareTemplate( string $name  )

Prepare a template

This can be used if you want to add variables to a template, that has not been loaded yet.

Parameters:
string   $name:  template name

API Tags:
Access:  public


[ Top ]
readTemplatesFromFile  [line 1041]

  true, readTemplatesFromFile( name $filename  )

open a file and parse for patTemplate tags

Parameters:
name   $filename:  of the file

API Tags:
Return:  if the template could be parsed
See:  patTemplate::readTemplatesFromInput()
Deprecated:  Use patTemplate::readTemplatesFromInput() instead, as the method name is misleading
Access:  public


[ Top ]
readTemplatesFromInput  [line 1057]

  boolean readTemplatesFromInput( string $input, [string $reader = 'File'], [array $options = null], [string $parseInto = null]  )

open any input and parse for patTemplate tags

Parameters:
string   $input:  name of the input (filename, shm segment, etc.)
string   $reader:  driver that is used as reader, you may also pass a Reader object
array   $options:  additional options that will only be used for this template
string   $parseInto:  name of the template that should be used as a container, should not be used by public calls.

API Tags:
Return:  true, if the template could be parsed, false otherwise
Access:  public


[ Top ]
setAttribute  [line 474]

  void setAttribute( string $template, string $attribute, mixed $value  )

Sets an attribute of a template

supported attributes: visibilty, loop, parse, unusedvars

Parameters:
string   $template:  name of the template
string   $attribute:  name of the attribute
mixed   $value:  value of the attribute

API Tags:
See:  patTemplate::setAttributes(), patTemplate::getAttribute(), patTemplate::clearAttribute()
Access:  public


[ Top ]
setAttributes  [line 501]

  void setAttributes( string $template, array $attributes  )

Sets several attribute of a template

$attributes has to be a assotiative arrays containing attribute/value pairs supported attributes: visibilty, loop, parse, unusedvars

Parameters:
string   $template:  name of the template
array   $attributes:  attribute/value pairs

API Tags:
See:  patTemplate::setAttribute(), patTemplate::getAttribute(), patTemplate::clearAttribute()
Access:  public


[ Top ]
setBasedir  [line 283]

  void setBasedir( string $basedir  )

sets name of directory where templates are stored

Parameters:
string   $basedir:  dir where templates are stored

API Tags:
Deprecated:  please use patTemplate::setRoot() instead
Access:  public


[ Top ]
setDefaultAttribute  [line 345]

  void setDefaultAttribute( string $name, mixed $value  )

set default attribute

Parameters:
string   $name:  attribute name
mixed   $value:  attribute value

API Tags:
Access:  public


[ Top ]
setDefaultAttributes  [line 356]

  void setDefaultAttributes( array $attributes  )

set default attributes

Parameters:
array   $attributes:  attributes

API Tags:
Access:  public


[ Top ]
setNamespace  [line 322]

  void setNamespace( string|array $ns  )

sets namespace of patTemplate tags

If you want to use more than one namespace, you may set this to an array. All tags in these namespaces will be treated as patTemplate tags.

Parameters:
string|array   $ns:  namespace(s)

API Tags:
Access:  public


[ Top ]
setOption  [line 256]

  void setOption( string $option, string $value  )

sets an option

Currently, the following options are supported

  • maintainBc (true|false)
  • namespace (string)

Parameters:
string   $option:  option to set
string   $value:  value of the option

API Tags:
Access:  public


[ Top ]
setRoot  [line 296]

  void setRoot( string $root, [ $reader = '__default']  )

sets root base for the template

The parameter depends on the reader you are using.

Parameters:
string   $root:  root base of the templates
   $reader: 

API Tags:
Access:  public


[ Top ]
setTags  [line 406]

  boolean setTags( string $startTag, string $endTag  )

set the start and end tag for variables

Parameters:
string   $startTag:  start tag
string   $endTag:  end tag

API Tags:
Return:  true on success
Access:  public


[ Top ]
setType  [line 379]

  boolean setType( string $type  )

set the type for the templates

Parameters:
string   $type:  type (html or tex)

API Tags:
Return:  true on success
Access:  public


[ Top ]
useTemplateCache  [line 960]

  boolean useTemplateCache( string $cache, [array $params = array()]  )

enable a template cache

A template cache will improve performace, as the templates do not have to be read on each request.

Parameters:
string   $cache:  name of the template cache
array   $params:  parameters for the template cache

API Tags:
Return:  true on success, patError otherwise
Access:  public


[ Top ]
_applyModifers  [line 1806]

  boolean _applyModifers( string $template, array &$vars  )

apply variable modifiers

The variables will be passed by reference.

Parameters:
string   $template:  name of the template (use modifiers from this template)
array   &$vars:  variables to which the modifiers should be applied

API Tags:
Access:  private


[ Top ]
_fetchTemplate  [line 1885]

  boolean _fetchTemplate( string $template  )

fetch plain template

The template content will be stored in the template configuration so it can be used by other methods.

Parameters:
string   $template:  template name

API Tags:
Access:  private


[ Top ]
_fetchVariables  [line 2121]

  boolean _fetchVariables( string $template  )

fetch variables for a template

The variables will be stored in the template configuration so they can be used by other methods.

Parameters:
string   $template:  template name

API Tags:
Access:  private


[ Top ]
_getConditionValue  [line 2019]

  void _getConditionValue( string $template, string $value, [boolean $isVar = true]  )

fetch the value of a condition variable

_fetchVariables() has to be called before this method is being called.

Parameters:
string   $template:  template name
string   $value:  condition value
boolean   $isVar:  flag that indicates whether value is the name of the variable that should be resolved

API Tags:
Access:  private

Information Tags:
Todo:  split this method into smaller check methods that will be called according to a priority list

[ Top ]
_getDependencies  [line 2480]

  array _getDependencies( string $template  )

get _all_ dependencies of a template, regardless of the subtemplates

Parameters:
string   $template:  template name

API Tags:
Return:  list of all subtemplates
Access:  private


[ Top ]
_handleUnusedVars  [line 2219]

  void _handleUnusedVars( string $template  )

handle all unused variables in a template

This is influenced by the 'unusedvars' attribute of the template

Parameters:
string   $template: 

API Tags:
Access:  private


[ Top ]
_hasVariables  [line 1994]

  boolean _hasVariables( string $template  )

check, whether a template contains variables

Parameters:
string   $template:  template name

API Tags:
Access:  private


[ Top ]
_initTemplate  [line 1679]

  boolean _initTemplate( string $template  )

Initialize a template

This method checks the variable specifications and copys variables from other templates.

Parameters:
string   $template:  name of the template

API Tags:
Return:  true on success
Access:  private


[ Top ]
_loadTemplatesFromCache  [line 1257]

  array|boolean _loadTemplatesFromCache( string $input, string &$reader, array $options, string $key  )

load from template cache

Parameters:
string   $input:  name of the input (filename, shm segment, etc.)
string   &$reader:  driver that is used as reader, you may also pass a Reader object
array   $options:  options for the reader
string   $key:  cache key

API Tags:
Return:  either an array containing the templates, or false
Access:  private


[ Top ]
_parseDependencies  [line 1859]

  void _parseDependencies( string $template  )

parse all dependencies in a template

Parameters:
string   $template: 

API Tags:
Access:  private


[ Top ]
_parseGlobals  [line 1778]

  boolean _parseGlobals( string $template  )

parse global variables in the template

Parameters:
string   $template:  name of the template

API Tags:
Access:  private


[ Top ]
_parseVariables  [line 1737]

  void _parseVariables( string $template  )

parse all variables in a template

Parameters:
string   $template: 

API Tags:
Access:  private


[ Top ]
__toString  [line 2641]

  string __toString( )

Convert the template to its string representation.

This method allows you to just echo the patTemplate object in order to display the template.

Requires PHP5

  1.  $tmpl new patTemplate();
  2.  $tmpl->readTemplatesFromFile'myfile.tmpl' );
  3.  echo $tmpl;


API Tags:
Access:  private


[ Top ]

The site fititnt.org is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. If you are looking for official documentation, visit api.joomla.org and docs.joomla.org.
Documentation generated on Mon, 26 Oct 2009 22:55:13 -0200 by phpDocumentor 1.4.3