pclib
3.0.0
Lightweight PHP framework
|
Template extended with 'head' tag, allowing add links to *.js and *.css files. More...
Public Member Functions | |
loadSession () | |
Load application state from session. | |
saveSession () | |
Save application state to session. | |
addScripts () | |
Add links to *.css, *.js scripts into template. More... | |
addMessage ($message, $cssClass=null, $params=array()) | |
Add flash (session stored) message. More... | |
print_Head ($id, $sub, $value) | |
Print content of webpage HEAD section. More... | |
print_Messages ($id, $sub, $value) | |
Print flash messages. More... | |
print_Navigator ($id, $sub, $value) | |
Print breadcrumb navigator. More... | |
print_Element ($id, $sub, $value) | |
This function is called for each template tag when it is printed. More... | |
Public Member Functions inherited from Tpl | |
__construct ($path='', $sessName='') | |
Load and parse template file. More... | |
init () | |
Initialization - must be called after load() | |
load ($path) | |
Load template file. More... | |
loadString ($s) | |
Load string $s as template. More... | |
out ($block=null) | |
Display template populated with content. More... | |
html ($block=null) | |
Return html output of the template populated with content. More... | |
enable () | |
Enable (show) or disable (hide) tag or block $name. More... | |
disable () | |
Disable (hide) tag or block $name. More... | |
setAttr ($id, $value, $value2=null) | |
Set attribute globally for template elements. More... | |
getBlock ($block) | |
Return values of block $block. More... | |
getValue ($id) | |
Return value of element $id. More... | |
deleteSession () | |
Remove object from session. | |
create ($tableName, $templatePath='') | |
Use default template for displaying database table content. | |
print_Number ($id, $sub, $value) | |
Print numeric $value. More... | |
print_String ($id, $sub, $s) | |
Print string $value. More... | |
print_Bind ($id, $sub, $value) | |
Bind $value to LABEL coming from datasource and print LABEL. More... | |
print_Link ($id, $sub, $value) | |
Create html link. More... | |
print_Env ($id, $sub, $value) | |
Print value from url (from _GET array). More... | |
print_Class ($id, $sub, $value) | |
Print all fields into template. More... | |
print_Action ($id, $sub, $value) | |
Call controller's method and include result into template. More... | |
print_Block ($block) | |
Print template block. More... | |
addTag ($line) | |
Add new element. More... | |
addType ($name, $fn) | |
Add new type of element handled by callback function $fn. More... | |
setFields ($fields) | |
Show only this $fields in template (using tag {grid.fields} or {form.fields}). More... | |
htmlTag ($name, $attr=[], $content=null) | |
Return html tag $name with attributes. More... | |
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 Tpl | |
$name | |
Name of the template. | |
$elements = array() | |
Array of elements loaded from <?elements ? > section. | |
$values = array() | |
Array of template values. | |
$db | |
var Db | |
$router | |
var Router | |
$escapeHtmlFunction | |
Function for escaping html in template values. | |
Data Fields inherited from BaseObject | |
$serviceLocator | |
var function() Return service object when requested with service(). | |
Protected Member Functions inherited from Tpl | |
getAttr ($id, $attr) | |
Return attribute of element $id. More... | |
getVariable ($id) | |
Get template variable tvar... | |
getRowNo () | |
Return row number of the current block. | |
createFromTable ($tableName, $templatePath) | |
Use default template for displaying database table content. | |
compute ($id) | |
Return computed value of element $id. | |
trPrintElement ($elem) | |
Print element in table layout. More... | |
getPopup ($id, $attr, $url) | |
Generate javascript code for popup window. More... | |
getUrl ($elem) | |
Return url for the element (button, link) with completed parameters. | |
formatDate ($dtstr, $fmt='') | |
DATABASE DATE => HUMAN DATE (in date() format) More... | |
formatStr ($s, $fmt) | |
Format string $s according format $fmt. | |
getItems ($id) | |
Load lookup table for elements such as bind, select, check or radio. More... | |
Protected Member Functions inherited from BaseObject | |
service ($service, $default=null) | |
Try acquire $service and load it into property $this->$service. More... | |
Protected Attributes inherited from Tpl | |
$sessName | |
Name of the session variable where template values are stored. More... | |
$app | |
var App Link to application object. | |
$config = null | |
Link to array of configuration parameters. | |
$document | |
Document array - It contains parsed template. | |
$parser | |
var TplParser | |
$fields = [] | |
List of id's to be printed in {grid.fields} tag. | |
$types = [] | |
Additional element type handlers. | |
Template extended with 'head' tag, allowing add links to *.js and *.css files.
Moreover it contains support of flash messages.
addMessage | ( | $message, | |
$cssClass = null , |
|||
$params = array() |
|||
) |
Add flash (session stored) message.
Template must contains a messages tag.
string | $message | |
string | $cssClass | Css-class of the message div |
mixed | $args | Variable number of message arguments |
addScripts | ( | ) |
Add links to *.css, *.js scripts into template.
Template must contains a head tag. Example: $app->layout->addScripts('js/jquery.js', 'css/bootstrap.css');
array|variable_number_of_arguments | List of paths to css and js files |
print_Element | ( | $id, | |
$sub, | |||
$value | |||
) |
This function is called for each template tag when it is printed.
You can redefine this function in descendant and add your own element types.
string | $id | name of template tag {ID} |
string | $sub | modificator (second part) of template tag name {ID.sub} |
mixed | $value | value of element going from Tpl->values array |
Reimplemented from Tpl.
print_Head | ( | $id, | |
$sub, | |||
$value | |||
) |
Print content of webpage HEAD section.
string | $id | name of template tag {ID} |
string | $sub | modificator (second part) of template tag name {ID.sub} |
mixed | $value | value of element going from Tpl->values array |
print_Messages | ( | $id, | |
$sub, | |||
$value | |||
) |
Print flash messages.
string | $id | name of template tag {ID} |
string | $sub | modificator (second part) of template tag name {ID.sub} |
mixed | $value | value of element going from Tpl->values array |
print_Navigator | ( | $id, | |
$sub, | |||
$value | |||
) |
Print breadcrumb navigator.
string | $id | name of template tag {ID} |
string | $sub | modificator (second part) of template tag name {ID.sub} |
mixed | $value | value of element going from Tpl->values array |