Flexy uses a single lightweight class to represent All HTML Tags, All the variables of the class are public, and you are encouraged to use them. And the methods provide generic assignment and conversion abilities.
To force th toHtml() method to generate XHTML, rather than standard HTML, use $element->setAttribute('flexy:xhtml','yes'); or add flexy:xhtml="true" to the attribute of the element in the template.
$tag - The name of the HTML Tag eg. img for <img ....
$attributes - Associative array of attributes, where key="value" is output when you turn it in toHtml(), If you need to represent a attribute without a value, use TRUE as the value. This also accepts a string in the format "href='/test.jpg' alt='test'", which will be parsed into the attributes array of the object.
The name of the html element eg. img for <img...
Attributes for the element
All the sub elements inside this, can be any object that implements toHtml(), or a string.
this value of thiswill be output when toHtml() is called, rather than the tags.
string or object that implements toHtml() method, and is returned by toHtml() before the tag HTML
string or object that implements toHtml() method, and is returned by toHtml() after the tag HTML
when you create an element, that is to be merged later with a full definition, you can assign the value here, and during toHtml(), the toValue() method will be called and select options, checkboxes and input values will be correctly filled in.
Example 41-1. Using an element to change a template.
|
Example 41-2. template example
|
Example 41-3. output from the Template
|