Summary
- File
- Package hierarchy Template\data
- Class hierarchy \DefaultTemplateData
- Implements \TemplateData
This class is a default implementation of the {@link TemplateData} interface.
This class is a default implementation of the {@link TemplateData} interface.
enable_strict_mode()
Enables the strict mode. If a variable that does not exist in the object is requested, then an exception will be raised.
None found |
disable_strict_mode()
Disables the strict mode. If a variable that does not exist in the object is requested, then an empty value will be returned.
None found |
auto_load_frequent_vars()
Loads the most common vars which are useful in the whole PHPBoost templates. The variables are: <ul> <li>THEME the theme used by the current user</li> <li>LANG the lang used by the current user</li> <li>IS_USER_CONNECTED tells whether the user is connected (member, moderator or administrator)</li> <li>IS_ADMIN tells whether the user is administrator</li> <li>IS_MODERATOR tells whether the user is moderator</li> <li>IS_MOBILE_DEVICE tells whether the site is displayed on a mobile device</li> <li>PATH_TO_ROOT is the path which starts from the domain root (in HTTP context) and goes to the PHPBoost root. For instance if PHPBoost is installed at www.example.com/directory/, its value will be /directory.</li> <li>PHP_PATH_TO_ROOT is the server side path, it's the path which goes to the PHPBoost's root.</li> <li>TOKEN is the CSRF protection token. It's to use in the critical actions to show that the user really intended doing the action</li> <li>REWRITED_SCRIPT the current url</li> <li>C_*TEXT_EDITOR_NAME*_EDITOR for each installed editor, tell if current user use it or not. For instance C_BBCODE_EDITOR.</li> </ul>
None found |
put( $key, $value)
Assigns the value <code>$value</code> to the template variable of name <code>$key</code>
$key | the template parameter name |
|
$value | the template parameter value |
None found |
put_all(array $vars)
Assigns template variables. It could be simple variables, loop or subtemplates.
array | $vars | A map key => value where |
None found |
assign_block_vars(string $block_name, array $array_vars, array $subtemplates = array())
Assigns a template block. A block represents a loop and has a name which be used in your template file to indicate which loop you want to browse.
To know what syntax to use to browse a loop, see the class description, there are examples.
string | $block_name | Block name. |
array | $array_vars | A map var_name => var_value. Generally, var_name is written in caps characters. |
array | $subtemplates | The list of subtemplates to embed in the loop's iteration. |
None found |
get_block(string $blockname) : array<mixed,mixed>
Returns the block $blockname in the template block list
string | $blockname | the blockname of the block to retrieve |
the requested block
None found |
get_block_from_list(string $blockname, array<mixed,mixed> $parent_block) : array<mixed,mixed>
Returns the block $blockname in the parent_block
string | $blockname | the blockname of the block to retrieve |
array<mixed,mixed> | $parent_block | the parent block in which $blockname will be searched for |
The requested block
None found |
is_true( $value) : boolean
Tells whether a condition is true. Conditions are global boolean variables.
$value |
true if the variable $varname exists and is not considered as false
None found |
get(string $varname) : string
Returns the $varname variable content searched in from the $list
string | $varname | the name of the variable to retrieve |
the $varname variable content
None found |
get_from_list(string $varname, array<mixed,mixed> $list) : string
Similar from the get_var method but it works with loop variables instead of global variables.
string | $varname | The name of the variable to retrieve |
array<mixed,mixed> | $list | The list into which retrieve the variable |
The variable content
None found |
bind_vars(\TemplateData $data)
Binds vars on another {@link TemplateData} object. The two instances will share the same data.
\TemplateData | $data | The data to use. |
None found |
register_var( $name, $value, $list)
$name | ||
$value | ||
$list |
None found |