{% element %}

This tag is a shortcut for outputting an HTML tag.

Syntax

{% element
tagname
 
This may evaluate to any valid tag name
attribute_name:attribute_value
 
You may include as many attributes as desired. If either attribute_name or attribute_value is null or empty then the attribute will NOT be output in the tag. All attributes output by the {% element %} method MUST have a value. Attribute values will be properly encoded.
etc...
/
 
If you end the {% element %} method with '/' then the element will be auto-closed (eg: {% element 'hr' / %} => <hr/>. If you do NOT end the {% element %} method with '/' then the element will not be closed until the matching {% endelement %} method.
%}

Examples

Output self-closing input element

Copy
{% element 'input' type:'text' name:'username' placeholder:'Username' required:required / %}

Output content inside div

Copy
{% element 'div' id:'maincontent' class:'container wide' %} {% include '/maincontent' %} {% endelement %}