Properties

$_tmpl

$_tmpl : object

reference to the patTemplate object that instantiated the module

Type

object

$_elStack

$_elStack : array

stack for all open elements

Type

array

$_tmplStack

$_tmplStack : array

stack for all open templates

Type

array

$_data

$_data : array

character data

Type

array

$_depth

$_depth : integer

tag depth

Type

integer

$_templates

$_templates : array

templates that have been found

Type

array

$_path

$_path : array

path to the template

Type

array

$_startTag

$_startTag : string

start tag for variables

Type

string

$_endTag

$_endTag : string

end tag for variables

Type

string

$_defaultAtts

$_defaultAtts : array

default attributes

Type

array

$_rootAtts

$_rootAtts : array

root attributes

This is used when reading the template content from an external file.

Type

array

$_inheritAtts

$_inheritAtts : array

inherit attributes

Type

array

$_root

$_root : string

name of the first template that has been found

Type

string

$_processedData

$_processedData : string

all data that has been processed

Type

string

$_currentInput

$_currentInput : string

current input

Type

string

$_functions

$_functions : array

all loaded functions

Type

array

$_funcAliases

$_funcAliases : array

function aliases

Type

array

$_options

$_options : array

options

Type

array

$_inUse

$_inUse : boolean

reader is in use

Type

boolean

$_name

$_name : string

reader name

Type

string

$_params

$_params : array

module parameters

Type

array

$_files

$_files : array

files that have been used

Type

array

Methods

setTemplateReference()

setTemplateReference(  $tmpl) 

set a reference to the patTemplate object that instantiated the reader

Parameters

$tmpl

readTemplates()

readTemplates(  $input) : array

read templates from any input

Parameters

$input

Returns

array —

templates

loadTemplate()

loadTemplate(  $input) : string

load template from any input

If the a template is loaded, the content will not get analyzed but the whole content is returned as a string.

Parameters

$input

Returns

string —

template content

setOptions()

setOptions(  $options) 

set options

Parameters

$options

addFunctionAlias()

addFunctionAlias(  $alias,   $function) 

add an alias for a function

Parameters

$alias
$function

setRootAttributes()

setRootAttributes(  $attributes) 

set the root attributes

Parameters

$attributes

parseString()

parseString(  $string) : array

parse templates from string

Parameters

$string

Returns

array —

templates

_parseAttributes()

_parseAttributes(  $string) 

parse an attribute string and build an array

Parameters

$string

_startElement()

_startElement(  $ns,   $name,   $attributes) 

handle start element

Parameters

$ns
$name
$attributes

_endElement()

_endElement(  $ns,   $name) 

handle end element

Parameters

$ns
$name

_characterData()

_characterData(  $data,   $readFromTemplate = true) 

handle character data

Parameters

$data
$readFromTemplate

_initLink()

_initLink(  $attributes) : boolean

handle a Link

Parameters

$attributes

Returns

boolean —

true on success

_closeLink()

_closeLink(  $tmpl) 

close a link template

It will be added to the dependecies of the parent template.

Parameters

$tmpl

_initTemplate()

_initTemplate(  $attributes) : boolean

create a new template

Parameters

$attributes

Returns

boolean —

true on success

_prepareTmplAttributes()

_prepareTmplAttributes(  $attributes,   $templatename) : array

prepare attributes

Parameters

$attributes
$templatename

Returns

array —

attributes

_buildTemplateName()

_buildTemplateName() : string

build a template name

Returns

string —

new template name

_closeTemplate()

_closeTemplate(  $tmpl,   $data) : boolean

close the current template

Parameters

$tmpl
$data

Returns

boolean —

true on success

_initSubTemplate()

_initSubTemplate(  $attributes) : boolean

create a new sub-template

Parameters

$attributes

Returns

boolean —

true on success

_closeSubTemplate()

_closeSubTemplate(  $subTmpl,   $data) : boolean

close subtemplate

Parameters

$subTmpl
$data

Returns

boolean —

true on success

_handleVariable()

_handleVariable(  $attributes,   $data) : boolean

handle a variable

Parameters

$attributes
$data

Returns

boolean —

true on success

_handleComment()

_handleComment(  $attributes,   $data) : boolean

handle a comment

Parameters

$attributes
$data

Returns

boolean —

true on success

_getCData()

_getCData() : string

get the character data of the element

Returns

string

_addToParentTemplate()

_addToParentTemplate(  $property,   $value,   $key = null) 

add to a property of the parent template

Parameters

$property
$value
$key

_getFromParentTemplate()

_getFromParentTemplate(  $property,   $level = 1) : mixed

get a property of the parent template

Parameters

$property
$level

Returns

mixed —

value to add

_addToParentTag()

_addToParentTag(  $property,   $value,   $key = null) 

add to a property of the parent tag

Parameters

$property
$value
$key

_adjustWhitespace()

_adjustWhitespace(  $data,   $behaviour) : string

adjust whitespace in a CData block

Parameters

$data
$behaviour

Returns

string —

data

_inheritAttributes()

_inheritAttributes(  $attributes) : array

inherit attributes from the parent template

The following attributes are inherited automatically:

  • whitespace
  • unusedvars

Parameters

$attributes

Returns

array —

new attribute collection

_parentTagIs()

_parentTagIs(  $type) : boolean

checks, whether the parent tag is of a certain type

This is needed to ensure, that subtemplates are only placed inside a template

Parameters

$type

Returns

boolean

_getCurrentLine()

_getCurrentLine() : integer

get the current line number

Returns

integer —

line number

_createErrorMessage()

_createErrorMessage(  $msg) : \strin

create an error message

This method takes an error messages and appends the current line number as well as a pointer to the input (filename)

Parameters

$msg

Returns

\strin —

error message

getCurrentInput()

getCurrentInput() : string

get the current input

Returns

string

shouldMaintainBc()

shouldMaintainBc() : boolean

tests whether the reader should maintain backwards compatibility

If enabled, you can still use 'default', 'empty', 'odd' and 'even' instead of 'default', 'empty', etc.

This will be disabled by default in future versions.

Returns

boolean

isInUse()

isInUse() : boolean

returns, whether the reader currently is in use

Returns

boolean

getTemplateRoot()

getTemplateRoot() : string

get the template root for this reader

Returns

string

getName()

getName() : string

get the name of the module

Returns

string —

name of the module

setParams()

setParams(  $params,   $clear = false) 

sets parameters of the module

Parameters

$params
$clear

getParam()

getParam(  $name) : mixed

gets a parameter of the module

Parameters

$name

Returns

mixed —

value of the parameter

_resolveFullPath()

_resolveFullPath(  $filename) : string

resolve path for a template

Parameters

$filename

Returns

string —

full path

_getFileContents()

_getFileContents(  $file) : string

get the contents of a file

Parameters

$file

Returns

string —

file contents