pclib  2.3.2
Lightweight PHP framework
Public Member Functions
Layout Class Reference

Template extended with 'head' tag, allowing add links to *.js and *.css files. More...

Inheritance diagram for Layout:
Tpl BaseObject

Public Member Functions

 loadSession ()
 Load application state from session. More...
 
 saveSession ()
 Save application state to session. More...
 
 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...
 
- 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...
 
 set ($keystr, $value)
 Set attributes for template elements. More...
 
 getValue ($id)
 Return value of element $id. More...
 
 loadSession ()
 Load object from session.
 
 saveSession ()
 Save object to session.
 
 deleteSession ()
 Remove object from session.
 
 create ($tableName)
 Use default template for displaying database table content.
 
 compute ($id)
 Return computed value of element $id. More...
 
 print_Element ($id, $sub, $value)
 This function is called for each template tag when it is printed. More...
 
 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...
 
 getPopup ($id, $attr, $url)
 Generate javascript code for popup window. More...
 
 getItems ($id)
 Load lookup table for elements such as bind, select, check or radio. 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...
 
 addEvent ($name, $callback)
 Add event handler to $object->$name property. 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
 $onInit
 Occurs on template initialization. More...
 
 $onLoad
 Occurs after template is loaded and parsed. More...
 
 $onBeforeOut
 Occurs before output. More...
 
 $onAfterOut
 Occurs after output. More...
 
 $name
 Name of the template. More...
 
 $elements = array()
 Array of elements loaded from <?elements ? > section.
 
 $values = array()
 Array of template values. More...
 
 $db
 var Db
 
 $translator
 var Translator
 
 $router
 var Router
 
 $useXhtml = false
 Generate XHTML code. More...
 
 $escapeHtmlFunction
 Function for escaping html in template values. More...
 
- Data Fields inherited from BaseObject
 $onNewInstance
 Occurs when new instance of the class is created. More...
 
 $onMissingMethod
 Occurs when called method does not exist. More...
 
 $serviceLocator
 var function() Return service object when requested with service(). More...
 
- Protected Member Functions inherited from Tpl
 getAttr ($id, $attr)
 Return attribute of element $id. More...
 
 getVariable ($id)
 Get template variable tvar... More...
 
 getRowNo ()
 Return row number of the current block. More...
 
 createFromTable ($tableName, $templatePath)
 Use default template for displaying database table content.
 
 trPrintElement ($elem)
 Print element in table layout. More...
 
 getUrl ($elem)
 Return url for the element (button, link) with completed parameters. More...
 
 formatDate ($dtstr, $fmt= '')
 DATABASE DATE => HUMAN DATE (in strftime() format) More...
 
 formatStr ($s, $fmt)
 Format string $s according format $fmt.
 
- Protected Member Functions inherited from BaseObject
 fireEvent ($name, array $args=array())
 Run all event handlers in $object->$name property. More...
 
 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. More...
 
 $config = null
 Link to array of configuration parameters. More...
 
 $document
 Document array - It contains parsed template. More...
 
 $parser
 var TplParser
 

Detailed Description

Template extended with 'head' tag, allowing add links to *.js and *.css files.

Moreover it contains support of flash messages.

See also
App::setLayout()

Member Function Documentation

addMessage (   $message,
  $cssClass = null,
  $params = array() 
)

Add flash (session stored) message.

Template must contains a messages tag.

Parameters
string$message
string$cssClassCss-class of the message div
mixed$argsVariable 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');

Parameters
array|variable_number_of_argumentsList of paths to css and js files
loadSession ( )

Load application state from session.

print_Head (   $id,
  $sub,
  $value 
)

Print content of webpage HEAD section.

Template element handler
Get element definition from Tpl->elements and write element value from Tpl->values into template.
Note
This function comes in form print_*() where "*" is usually TAGNAME which can be used in <?elements ?> section of template.
Parameters
string$idname of template tag {ID}
string$submodificator (second part) of template tag name {ID.sub}
mixed$valuevalue of element going from Tpl->values array
print_Messages (   $id,
  $sub,
  $value 
)

Print flash messages.

Template element handler
Get element definition from Tpl->elements and write element value from Tpl->values into template.
Note
This function comes in form print_*() where "*" is usually TAGNAME which can be used in <?elements ?> section of template.
Parameters
string$idname of template tag {ID}
string$submodificator (second part) of template tag name {ID.sub}
mixed$valuevalue of element going from Tpl->values array
print_Navigator (   $id,
  $sub,
  $value 
)

Print breadcrumb navigator.

Template element handler
Get element definition from Tpl->elements and write element value from Tpl->values into template.
Note
This function comes in form print_*() where "*" is usually TAGNAME which can be used in <?elements ?> section of template.
Parameters
string$idname of template tag {ID}
string$submodificator (second part) of template tag name {ID.sub}
mixed$valuevalue of element going from Tpl->values array
saveSession ( )

Save application state to session.


The documentation for this class was generated from the following file: