phpBB API Documentation
Class

template

class template

Base Template class.

Properties

$_tpldata variable that holds all the data we'll be substituting into the compiled templates.
$_rootref
$root
$cachepath
$files
$filename
$files_inherit
$files_template
$inherit_root
$orig_tpl_storedb
$orig_tpl_inherits_id
$compiled_code

Methods

set_template()

Set template location

set_custom_template($template_path, $template_name, $fallback_template_path = false)

Set custom template location (able to use directory outside of phpBB)

set_filenames($filename_array)

Sets the template filenames for handles.

destroy()

Destroy template data set

destroy_block_vars($blockname)

Reset/empty complete block

display($handle, $include_once = true)

Display handle

assign_display($handle, $template_var = '', $return_content = true, $include_once = false)

Display the handle and assign the output to a template variable or return the compiled result.

_tpl_load($handle)

Load a compiled template if possible, if not, recompile it

assign_vars($vararray)

Assign key variable pairs from an array

assign_var($varname, $varval)

Assign a single variable to a single key

assign_block_vars($blockname, $vararray)

Assign key variable pairs from an array to a specified block

bool alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')

Change already assigned key variable pair (one-dimensional - single loop entry)

_tpl_include($filename, $include = true)

Include a separate template

_php_include($filename)

Include a php-file

Details

at line 52
public set_template()

Set template location

at line 93
public set_custom_template($template_path, $template_name, $fallback_template_path = false)

Set custom template location (able to use directory outside of phpBB)

Parameters

$template_path
$template_name
$fallback_template_path

at line 135
public set_filenames($filename_array)

Sets the template filenames for handles.

$filename_array should be a hash of handle => filename pairs.

Parameters

$filename_array

at line 164
public destroy()

Destroy template data set

at line 174
public destroy_block_vars($blockname)

Reset/empty complete block

Parameters

$blockname

at line 204
public display($handle, $include_once = true)

Display handle

Parameters

$handle
$include_once

at line 240
public assign_display($handle, $template_var = '', $return_content = true, $include_once = false)

Display the handle and assign the output to a template variable or return the compiled result.

Parameters

$handle
$template_var
$return_content
$include_once

at line 260
public _tpl_load($handle)

Load a compiled template if possible, if not, recompile it

Parameters

$handle

at line 445
public assign_vars($vararray)

Assign key variable pairs from an array

Parameters

$vararray

at line 459
public assign_var($varname, $varval)

Assign a single variable to a single key

Parameters

$varname
$varval

at line 470
public assign_block_vars($blockname, $vararray)

Assign key variable pairs from an array to a specified block

Parameters

$blockname
$vararray

at line 561
public bool alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')

Change already assigned key variable pair (one-dimensional - single loop entry)

An example of how to use this function: {@example alterblockarray.php}

Parameters

$blockname
$vararray
$key
$mode

Return Value

bool false on error, true on success

at line 647
public _tpl_include($filename, $include = true)

Include a separate template

Parameters

$filename
$include

at line 676
public _php_include($filename)

Include a php-file

Parameters

$filename