Class Trees Index phpDocumentor Project Page

Class tplTemplatez

(line 25)

Located in File: Program_Root/tplTemplatez.inc


tplTemplatez is a class used to separate PHP and HTML.

tplTemplatez is a class used to separate PHP and HTML. Easy to use. Very effective in hiding or showing blocks. No code or special instructions in template. Ability to parse nested blocks.


Class Variable Summary

$alt_blocks


Default Value: ->array()<-

$ee_block_tag


Default Value: -> ">"<-

$error_pref


Default Value: -> '<font color="#FF0000">TEMPLATEZ</font>'<-

$e_block_tag


Default Value: -> "</tmpl:"<-

$e_box_tag


Default Value: -> "-->"<-

$e_var_tag


Default Value: -> "}"<-

$need_alt_blocks


Default Value: ->array()<-

$parsed


Default Value: ->array()<-

$strip_vars


Default Value: -> false<-

$s_block_tag


Default Value: -> "<tmpl:"<-

$s_box_tag


Default Value: -> "<!--tmpl:"<-

$s_var_tag


Default Value: -> "{"<-

$tpl_blocks


Default Value: ->array()<-

$vars


Default Value: ->array()<-

Inherited Class Variable Summary


Method Summary

boolean

constructor tplTemplatez ( $tplfile, [$box = null] )


FUNCTION: tplTemplatez - constructor.
void

tplAssign ( $var, [$value = false] )


FUNCTION: tplAssign -- assigns variables to be used by the template.
true/false

tplParse ( [$array = array()], [$block = 'content'] )


FUNCTION: tplParse -- parses template block, replace {var} with values.
string

tplPrint ( [$to_return = false] )


FUNCTION: tplPrint -- Print or return the result of parsing template.
void

tplSetNeeded ( $alt_blocks )


FUNCTION: tplSetNeeded -- Set what blocks should be parced (hide or show).
void

tplSetNeededGlobal ( $alt_blocks )


FUNCTION: tplSetNeededGlobal -- Set what blocks should be parced (hide or show).
void

tplSetNested ( $block )


FUNCTION: tplSetNested -- Set nested block (loop).
void

tplShowTemplate ( [$block = null] )


FUNCTION: tplShowTemplate -- Prints the template code, for debugging purposes.
void

tplStripVars ( [$block = false] )


FUNCTION: tplStripVars -- Strips unassigned vars {var}.

Inherited Method Summary


Method Detail

Constructor tplTemplatez (line 63)

boolean

tplTemplatez( string $tplfile, [string $box = null])

FUNCTION: tplTemplatez - constructor.

FUNCTION: tplTemplatez - constructor. Loading the template file. Make all the necessary preparation with template.

Function Parameters:
- string $tplfile: path to template file
- string $box: certain part of page to be a template file
Function Info:
return - true
access - public

[ Top ]


tplAssign (line 231)

void

tplAssign( mixed $var, [mixed $value = false])

FUNCTION: tplAssign -- assigns variables to be used by the template.

FUNCTION: tplAssign -- assigns variables to be used by the template. If $var is an array, then it will treat it as an associative array using the keys as variable names and the values as variable values.

Function Parameters:
- mixed $var: to define variable name
- mixed $value: to define variable value
Function Info:
access - public

[ Top ]


tplParse (line 100)

true/false

tplParse( [array $array = array()], [string $block = 'content'])

FUNCTION: tplParse -- parses template block, replace {var} with values.

FUNCTION: tplParse -- parses template block, replace {var} with values. The template can has a lot of blocks, you needn't call this function to parse each of them Usually should be called to parse dynamic block, nested dynamic block or whole template To hide or show block use tplSetNeeded($alt_blocks) instead.

Function Parameters:
- array $array: array with template vars
- string $block: block to parse, by default the whole template
Function Info:
access - public

[ Top ]


tplPrint (line 254)

string

tplPrint( [bool $to_return = false])

FUNCTION: tplPrint -- Print or return the result of parsing template.

FUNCTION: tplPrint -- Print or return the result of parsing template.

Function Parameters:
- bool $to_return: use true to return result whithout printing
Function Info:
return - template
access - public

[ Top ]


tplSetNeeded (line 151)

void

tplSetNeeded( string $alt_blocks)

FUNCTION: tplSetNeeded -- Set what blocks should be parced (hide or show).

FUNCTION: tplSetNeeded -- Set what blocks should be parced (hide or show). The syntax for $alt_blocks (alternate blocks) is parent_block/alt_block_1/alt_block_2/... if parent block is whole template the syntax is /alt_block_1/alt_block_2/...

Function Parameters:
- string $alt_blocks: parent_block/alt_block_1/alt_block_2/...
Function Info:
access - public

[ Top ]


tplSetNeededGlobal (line 172)

void

tplSetNeededGlobal( string $alt_blocks)

FUNCTION: tplSetNeededGlobal -- Set what blocks should be parced (hide or show).

FUNCTION: tplSetNeededGlobal -- Set what blocks should be parced (hide or show). For example you have 5 blocks <tmpl:if_blah>...</tmpl:if_blah> and they are in different dinamyc or nested blocks. If you want show these blocks just call tplSetNeededGlobal('if_blah') after tplTemplatez($tplfile) and that's all, they will be printed.

Function Parameters:
- string $alt_blocks: alt_block_1/alt_block_2/...
Function Info:
access - public

[ Top ]


tplSetNested (line 202)

void

tplSetNested( string $block)

FUNCTION: tplSetNested -- Set nested block (loop).

FUNCTION: tplSetNested -- Set nested block (loop). It should be called after parsing nested block The syntax for $block is parent_block/nested_1/nested_2/... if parent block is whole template the syntax is /nested_1/nested_2/...

Function Parameters:
- string $block: parent_block/nested_1/nested_2/...
Function Info:
access - public

[ Top ]


tplShowTemplate (line 310)

void

tplShowTemplate( [string $block = null])

FUNCTION: tplShowTemplate -- Prints the template code, for debugging purposes.

FUNCTION: tplShowTemplate -- Prints the template code, for debugging purposes.

Function Parameters:
- string $block: with block to print, by default the whole template
Function Info:
access - public

[ Top ]


tplStripVars (line 285)

void

tplStripVars( [string $block = false])

FUNCTION: tplStripVars -- Strips unassigned vars {var}.

FUNCTION: tplStripVars -- Strips unassigned vars {var}. Sometimes can be useful not show unassigned vars after parsing template. Call it after tplParce() and before tplPrint()

Function Parameters:
- string $block: from what block to strip unassigned vars, by default from all parsed blocks
Function Info:
access - public

[ Top ]



Variable Detail

$alt_blocks

(line 31)
Data type: mixed


$ee_block_tag

(line 43)
Data type: mixed


$error_pref

(line 36)
Data type: mixed


$e_block_tag

(line 42)
Data type: mixed


$e_box_tag

(line 46)
Data type: mixed


$e_var_tag

(line 39)
Data type: mixed


$need_alt_blocks

(line 32)
Data type: mixed


$parsed

(line 33)
Data type: mixed


$strip_vars

(line 27)
Data type: mixed


$s_block_tag

(line 41)
Data type: mixed


$s_box_tag

(line 45)
Data type: mixed


$s_var_tag

(line 38)
Data type: mixed


$tpl_blocks

(line 30)
Data type: mixed


$vars

(line 34)
Data type: mixed




Documention generated on Sat, 5 Apr 2003 04:07:20 +0400 by phpDocumentor 1.2.0beta3