interface template

Methods

clear_cache()

Clear the cache

set_filenames(array $filename_array)

Sets the template filenames for handles.

array
get_user_style()

Get the style tree of the style preferred by the current user

set_style(array $style_directories = array('styles'))

Set style location based on (current) user's chosen style.

set_custom_style(string|array $names, string|array $paths)

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

destroy()

Clears all variables and blocks assigned to this template.

destroy_block_vars(string $blockname)

Reset/empty complete block

display(string $handle)

Display a template for provided handle.

template|string
assign_display(string $handle, string $template_var = '', bool $return_content = true)

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

assign_vars(array $vararray)

Assign key variable pairs from an array

assign_var(string $varname, string $varval)

Assign a single scalar value to a single key.

append_var(string $varname, string $varval)

Append text to the string value stored in a key.

array
retrieve_vars(array $vararray)

Retrieve multiple template values

mixed
retrieve_var(string $varname)

Retrieve a single scalar value from a single key.

assign_block_vars(string $blockname, array $vararray)

Assign key variable pairs from an array to a specified block

assign_block_vars_array(string $blockname, array $block_vars_array)

Assign key variable pairs from an array to a whole specified block loop

array
retrieve_block_vars(string $blockname, array $vararray)

Retrieve variable values from an specified block

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

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

mixed
find_key_index(string $blockname, mixed $key)

Find the index for a specified key in the innermost specified block

string
get_source_file_for_handle(string $handle)

Get path to template for handle (required for BBCode parser)

Details

at line 24
template clear_cache()

Clear the cache

Return Value

template

at line 32
template set_filenames(array $filename_array)

Sets the template filenames for handles.

Parameters

array $filename_array

Should be a hash of handle => filename pairs.

Return Value

template

$this

at line 39
array get_user_style()

Get the style tree of the style preferred by the current user

Return Value

array

Style tree, most specific first

at line 49
template set_style(array $style_directories = array('styles'))

Set style location based on (current) user's chosen style.

Parameters

array $style_directories

The directories to add style paths for E.g. array('ext/foo/bar/styles', 'styles') Default: array('styles') (phpBB's style directory)

Return Value

template

$this

at line 60
template set_custom_style(string|array $names, string|array $paths)

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

Note: Templates are still compiled to phpBB's cache directory.

Parameters

string|array $names

Array of names or string of name of template(s) in inheritance tree order, used by extensions.

string|array $paths

Array of style paths, relative to current root directory

Return Value

template

$this

at line 67
template destroy()

Clears all variables and blocks assigned to this template.

Return Value

template

$this

at line 75
template destroy_block_vars(string $blockname)

Reset/empty complete block

Parameters

string $blockname

Name of block to destroy

Return Value

template

$this

at line 87
template display(string $handle)

Display a template for provided handle.

The template will be loaded and compiled, if necessary, first.

This function calls hooks.

Parameters

string $handle

Handle to display

Return Value

template

$this

at line 98
template|string assign_display(string $handle, string $template_var = '', bool $return_content = true)

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

Parameters

string $handle

Handle to operate on

string $template_var

Template variable to assign compiled handle to

bool $return_content

If true return compiled handle, otherwise assign to $template_var

Return Value

template|string

if $return_content is true return string of the compiled handle, otherwise return $this

at line 106
template assign_vars(array $vararray)

Assign key variable pairs from an array

Parameters

array $vararray

A hash of variable name => value pairs

Return Value

template

$this

at line 117
template assign_var(string $varname, string $varval)

Assign a single scalar value to a single key.

Value can be a string, an integer or a boolean.

Parameters

string $varname

Variable name

string $varval

Value to assign to variable

Return Value

template

$this

at line 128
template append_var(string $varname, string $varval)

Append text to the string value stored in a key.

Text is appended using the string concatenation operator (.).

Parameters

string $varname

Variable name

string $varval

Value to append to variable

Return Value

template

$this

at line 136
array retrieve_vars(array $vararray)

Retrieve multiple template values

Parameters

array $vararray

An array with variable names

Return Value

array

A hash of variable name => value pairs (value is null if not set)

at line 144
mixed retrieve_var(string $varname)

Retrieve a single scalar value from a single key.

Parameters

string $varname

Variable name

Return Value

mixed

Variable value, or null if not set

at line 152
template assign_block_vars(string $blockname, array $vararray)

Assign key variable pairs from an array to a specified block

Parameters

string $blockname

Name of block to assign $vararray to

array $vararray

A hash of variable name => value pairs

Return Value

template

$this

at line 160
template assign_block_vars_array(string $blockname, array $block_vars_array)

Assign key variable pairs from an array to a whole specified block loop

Parameters

string $blockname

Name of block to assign $block_vars_array to

array $block_vars_array

An array of hashes of variable name => value pairs

Return Value

template

$this

at line 168
array retrieve_block_vars(string $blockname, array $vararray)

Retrieve variable values from an specified block

Parameters

string $blockname

Name of block to retrieve $vararray from

array $vararray

An array with variable names, empty array gets all vars

Return Value

array

A hash of variable name => value pairs (value is null if not set)

at line 198
bool alter_block_array(string $blockname, array $vararray, mixed $key = false, string $mode = 'insert')

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

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

Parameters

string $blockname

the blockname, for example 'loop'

array $vararray

the var array to insert/add or merge

mixed $key

Key to search for

array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]

int: Position [the position to change or insert at directly given]

If key is false the position is set to 0 If key is true the position is set to the last entry

string $mode

Mode to execute (valid modes are 'insert', 'change' and 'delete')

If insert, the vararray is inserted at the given position (position counting from zero). If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value). If delete, the vararray is ignored, and the block at the given position (counting from zero) is removed.

Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)

Return Value

bool

false on error, true on success

at line 215
mixed find_key_index(string $blockname, mixed $key)

Find the index for a specified key in the innermost specified block

Parameters

string $blockname

the blockname, for example 'loop'

mixed $key

Key to search for

array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]

int: Position [the position to search for]

If key is false the position is set to 0 If key is true the position is set to the last entry

Return Value

mixed

false if not found, index position otherwise; be sure to test with ===

at line 223
string get_source_file_for_handle(string $handle)

Get path to template for handle (required for BBCode parser)

Parameters

string $handle

Handle to retrieve the source file

Return Value

string