-
Notifications
You must be signed in to change notification settings - Fork 34
classes_base_template.class
Building blocks of web pages. Each template consist of a logic part and a layout part. The logic part is optional and can be handled by this (base) class (see Template::Make).
Extends: Renderable
Subclasses: GoogleAnalytics, HtmlPage, WdfListingFilter
Adds a value to an already defined var. If $name is not already an array it will be converted to one.
$tpl->set('a','one');
$tpl->add2var('a','two');
// $a is now array('one','two')
$tpl->set('a','three');
// $a is now 'three'
$tpl->add2var('b','four');
// $b is now array('four')
Definition: public function add2var($name, $value)
Returns: static
Parameters:
-
string $name
Variable name -
mixed $value
Value to add
Gets a variables value.
Definition: public function get($name)
Returns: mixed
Value of var
Parameters:
-
string $name
Var name
Gets all variables.
Definition: public function get_vars()
Returns: array
All variables
Creates a template with layout only. Sometimes you just want to separate parts of your layout without giving them some special logic. You may just store them as *.tpl.php files and create a template from them like this:
// assuming template file is 'templates/my.tpl.php'
$tpl = Template::Make('my');
$tpl->set('myvar','I am just layout');
Definition: public static function Make($template_basename=false)
Returns: static
The created template
Parameters:
-
string $template_basename
Name of the template
INTERNAL Will be executed on HOOK_PRE_RENDER. Prepares the template for output.
Set a variable for use in template file.
Definition: public function set($name, $value)
Returns: static
Parameters:
-
string $name
Var can be use in template under this name -
mixed $value
The value
Sets all template variables.
Definition: public function set_vars($vars, $clear=false)
Returns: static
Parameters:
-
array $vars
Key=>Value pairs of variables -
bool $clear
Overwrite the whole vars (defaults to false)
OVERRIDE Renderable::WdfRender
OVERRIDE Renderable::WdfRenderAsRoot
Constructs a Template
Definition: public function __construct($file)
Returns: NOT DOCUMENTED
Parameters:
-
$file
NOT DOCUMENTED
INTERNAL Magic method __get. See Member overloading