pclib
3.2.0
Lightweight PHP framework
|
Add variables or new element types globally for all templates. More...
Public Member Functions | |
set ($id, $value) | |
Set global template variable $id. More... | |
setArray (array $values) | |
Set array of global template variables. | |
reset () | |
Remove all global variables. | |
get ($id) | |
Get global template variable $id. | |
delete ($id) | |
Delete global template variable $id. | |
fetch ($id, array $params=[]) | |
Fetch global template variable $id (if it is callable, return result). | |
addGlobals (Tpl $t, array $params) | |
Add globals to template $t. | |
Public Member Functions inherited from BaseObject | |
loadDefaults ($className=null) | |
Load default parameters of class $className into object instance. | |
setProperties (array $defaults) | |
Set public properties of object from the array. More... | |
toArray () | |
Convert object to array. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from BaseObject | |
static | defaults () |
Set or retireve default parameters of the object. More... | |
Data Fields inherited from BaseObject | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions inherited from BaseObject | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Add variables or new element types globally for all templates.
Use like app service: $app->globals = new TplGlobals; You can define type like this: set('type:my_string', $fn); You can use modules: set('images.upload_dir', '/images');
set | ( | $id, | |
$value | |||
) |
Set global template variable $id.
string | $id | |
mixed | callable | $value | /can be callable function($o, $id, $sub, $value)/ |