phpBB API Documentation
Class

phpbb\template\base

abstract class base implements template

Methods

template set_filenames(array $filename_array)

Sets the template filenames for handles.

template destroy()

Clears all variables and blocks assigned to this template.

template destroy_block_vars(string $blockname)

Reset/empty complete block

template assign_vars(array $vararray)

Assign key variable pairs from an array

template assign_var(string $varname, string $varval)

Assign a single scalar value to a single key.

template 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)

Retreive a single scalar value from a single key.

template assign_block_vars(string $blockname, array $vararray)

Assign key variable pairs from an array to a specified block

template 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($blockname, array $vararray, $key = false, $mode = 'insert')

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

mixed find_key_index($blockname, $key)

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

Details

at line 36
public 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 57
public template destroy()

Clears all variables and blocks assigned to this template.

Return Value

template $this

at line 67
public template destroy_block_vars(string $blockname)

Reset/empty complete block

Parameters

string $blockname Name of block to destroy

Return Value

template $this

at line 77
public 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 90
public 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 100
public 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 110
public 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 123
public mixed retrieve_var(string $varname)

Retreive 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 131
public 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 141
public 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 $blockvarsarray to
array $block_vars_array An array of hashes of variable name => value pairs

Return Value

template $this

at line 151
public 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 159
public bool alter_block_array($blockname, array $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
array $vararray
$key
$mode

Return Value

bool false on error, true on success

at line 167
public mixed find_key_index($blockname, $key)

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

Parameters

$blockname
$key

Return Value

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