bigace.classes.template
[ class tree: bigace.classes.template ] [ index: bigace.classes.template ] [ all elements ]

Class: HtmlTemplate

Source Location: /classes/template/HtmlTemplate.php

Class Overview


This file was originally taken from PHP 5 Pear.


Variables

Methods


Inherited Constants

Inherited Variables

Inherited Methods


Class Details

[line 36]
This file was originally taken from PHP 5 Pear.

It was customized for BIGACE - now enabled to use callback functions to make it easier to design HTML with automatic translation and styling!




[ Top ]


Class Variables

$blockdata = array()

[line 51]


Type:   mixed


[ Top ]

$blockinner = array()

[line 53]


Type:   mixed


[ Top ]

$blocklist = array()

[line 50]


Type:   mixed


[ Top ]

$blocknameRegExp =  "[0-9A-Za-z_-]+"

[line 41]


Type:   mixed


[ Top ]

$blockRegExp =  ""

[line 47]


Type:   mixed


[ Top ]

$blockvariables = array()

[line 52]


Type:   mixed


[ Top ]

$callbackBlocknames = array()

[line 68]


Type:   mixed


[ Top ]

$clearCache =  false

[line 38]


Type:   mixed


[ Top ]

$clearCacheOnParse =  false

[line 57]


Type:   mixed


[ Top ]

$closingDelimiter =  "}"

[line 40]


Type:   mixed


[ Top ]

$currentBlock =  "__global__"

[line 48]


Type:   mixed


[ Top ]

$fileRoot =  ""

[line 58]


Type:   mixed


[ Top ]

$flagBlocktrouble =  false

[line 59]


Type:   mixed


[ Top ]

$flagCacheTemplatefile =  true

[line 61]


Type:   mixed


[ Top ]

$flagGlobalParsed =  false

[line 60]


Type:   mixed


[ Top ]

$lastTemplatefile =  ""

[line 62]


Type:   mixed


[ Top ]

$openingDelimiter =  "{"

[line 39]


Type:   mixed


[ Top ]

$removeEmptyBlocks =  true

[line 46]


Type:   mixed


[ Top ]

$removeUnknownVariables =  true

[line 45]


Type:   mixed


[ Top ]

$removeVariablesRegExp =  ""

[line 44]


Type:   mixed


[ Top ]

$template =  ""

[line 49]


Type:   mixed


[ Top ]

$touchedBlocks = array()

[line 54]


Type:   mixed


[ Top ]

$variableCache = array()

[line 56]


Type:   mixed


[ Top ]

$variablenameRegExp =  "[0-9A-Za-z_-]+"

[line 42]


Type:   mixed


[ Top ]

$variablesRegExp =  ""

[line 43]


Type:   mixed


[ Top ]

$_hiddenBlocks = array()

[line 55]


Type:   mixed


[ Top ]

$_options = array(
        'preserve_data' => false,
        'use_preg'      => true
    )

[line 63]


Type:   mixed


[ Top ]



Class Methods


constructor HtmlTemplate [line 89]

HtmlTemplate HtmlTemplate( [string $root = ""], [mixed $options = null])

Builds some complex regular expressions and optinally sets the file root directory.

Make sure that you call this constructor if you derive your template class from this one.




Tags:



Parameters:

string   $root   File root directory, prefix for all filenames given to the object.

[ Top ]

method buildBlockvariablelist [line 535]

void buildBlockvariablelist( )

Build a list of all variables within of a block



[ Top ]

method findBlocks [line 590]

void findBlocks( string $string)

Recusively builds a list of all blocks within the template.



Tags:



Parameters:

string   $string   string that gets scanned

[ Top ]

method free [line 450]

void free( )

Clears all datafields of the object.

Don't use this function unless you know what you're doing.




Tags:

see:  HtmlTemplate::init()
access:  public


[ Top ]

method get [line 176]

string get( [string $block = "__global__"])

Returns a block with all replacements done.



Tags:

see:  HtmlTemplate::show()
access:  public


Parameters:

string   $block   name of the block

[ Top ]

method getFile [line 645]

string getFile( string $filename)

Reads a file from disk and returns its content.



Tags:

return:  Filecontent


Parameters:

string   $filename   Filename

[ Top ]

method getGlobalvariables [line 565]

void getGlobalvariables( )

Returns a list of all global variables



[ Top ]

method init [line 432]

void init( )

Clears all datafields of the object and rebuild the internal blocklist

LoadTemplatefile() and setTemplate() automatically call this function when a new template is given. Don't use this function unless you know what you're doing.




Tags:

see:  HtmlTemplate::free()
access:  public


[ Top ]

method loadTemplatefile [line 514]

boolean loadTemplatefile( string $filename, [bool $removeUnknownVariables = true], [bool $removeEmptyBlocks = true])

Reads a template file from the disk.



Tags:



Parameters:

string   $filename   name of the template file
bool   $removeUnknownVariables   how to handle unknown variables.
bool   $removeEmptyBlocks   how to handle empty blocks.

[ Top ]

method parse [line 212]

void parse( [string $block = "__global__"], [mixed $flag_recursion = false])

Parses the given block.



Tags:

see:  HtmlTemplate::parseCurrentBlock()
access:  public


Parameters:

string   $block   name of the block to be parsed

[ Top ]

method parseCurrentBlock [line 350]

void parseCurrentBlock( )

Parses the current block



Tags:



[ Top ]

method setCallbackBlockname [line 73]

void setCallbackBlockname( mixed $name, mixed $callback)



[ Top ]

method setCallbackBlocknames [line 69]

void setCallbackBlocknames( mixed $blockarray)



[ Top ]

method setCurrentBlock [line 392]

boolean setCurrentBlock( [string $block = "__global__"])

Sets the name of the current block that is the block where variables are added.



Tags:

return:  false on failure, otherwise true
access:  public


Parameters:

string   $block   name of the block

[ Top ]

method setOption [line 132]

mixed setOption( string $option, mixed $value)

Sets the option for the template class



Tags:

return:  CODE_OK on success, error object on failure
access:  public


Parameters:

string   $option   option name
mixed   $value   option value

[ Top ]

method setOptions [line 153]

mixed setOptions( string $options, mixed 1)

Sets the options for the template class



Tags:

return:  CODE_OK on success, error object on failure
see:  $options
access:  public


Parameters:

mixed   1   option value
string   $options   options array of options default value: 'preserve_data' => false, 'use_preg' => true

[ Top ]

method setRoot [line 114]

void setRoot( mixed $root)

Sets the file root. The file root gets prefixed to all filenames passed to the object.

Make sure that you override this function when using the class on windows.




[ Top ]

method setTemplate [line 475]

void setTemplate( string $template, [boolean $removeUnknownVariables = true], [boolean $removeEmptyBlocks = true])

Sets the template.

You can eighter load a template file from disk with LoadTemplatefile() or set the template manually using this function.




Tags:

access:  public
see:  LoadTemplatefile(), HtmlTemplate::$template


Parameters:

string   $template   template content
boolean   $removeUnknownVariables   remove unknown/unused variables?
boolean   $removeEmptyBlocks   remove empty blocks?

[ Top ]

method setVariable [line 368]

void setVariable( mixed $variable, [string $value = ""], string 2)

Sets a variable value.

The function can be used eighter like setVariable( "varname", "value") or with one array $variables["varname"] = "value" given setVariable($variables) quite like phplib templates set_var().




Tags:

access:  public


Parameters:

string   2   prefix for variable names
mixed   $variable   string with the variable name or an array %variables["varname"] = "value"
string   $value   value of the variable or empty if $variable is an array.

[ Top ]

method show [line 164]

void show( [mixed $block = "__global__"])

Print a certain block with all replacements done.



[ Top ]

method touchBlock [line 411]

boolean touchBlock( string $block)

Preserves an empty block even if removeEmptyBlocks is true.



Tags:

return:  false on false, otherwise true
see:  HtmlTemplate::$removeEmptyBlocks
access:  public


Parameters:

string   $block   name of the block

[ Top ]

method _addPregDelimiters [line 670]

void _addPregDelimiters( mixed $str)

Adds delimiters to a string, so it can be used as a pattern

in preg_* functions




[ Top ]

method _preserveOpeningDelimiter [line 679]

void _preserveOpeningDelimiter( mixed $str)

Replaces an opening delimiter by a special string



[ Top ]


Documentation generated on Tue, 11 Oct 2005 23:02:06 +0200 by phpDocumentor 1.3.0RC2