Tmplz Tags |
Extra Tags: AttrSectionThis tag is only useful when writing HTML (or XHTML). It provides a workaround to a minor quirk where raw templates can fail HTML validation. BackgroundSuppose one wants to create a generic template for checkboxes. One way to write it would be: <input type="checkbox" checked="[$Slot OnOff]" name="Elephant" value="yes"/>
This is "wrong", however, because standards dictate that the only valid value for <input type="checkbox" [$Section checked]checked="checked"[$Section] name="Elephant" value="yes"/>
We placed a Section around the SolutionEnter the AttrSection tag: [$AttrSection checked] <input type="checkbox" checked="checked" name="Elephant" value="yes"/>
This accomplishes the exact same thing as the second example above, using valid HTML: The Variations
The Section name doesn't have to be the same name as the attribute. This creates a Section named "WeHaveElephants" which wraps the [$AttrSection WeHaveElephants checked] <input type="checkbox" checked="checked" name="Elephant" value="yes"/> Also, as should be expected, the attribute itself can contain anything a Section can contain: [$AttrSection class] <div class="[$Section Default]default[$Section] [$Slot Additional]"/> This is the end of the Tmplz Tags documentation.
|