Formidable features a flexible template engine

What does it do ?

The template engine built-in formidable provides many features for designing flexible yet powerful templates

Where to get the code ?

The next example is based on these snippets:

Take some time to have a look at the HTML snippet, as all the magic lies inside !

See it in action

This will display the renderlet in default-mode

Here, we recombine the label and the input

To know what data is available, we execute debug()

__compiledSTRING(243): <label id='feature-template.mytxt_label' class='feature-template.mytxt_label' for="feature-template.mytxt">Some text field</label>
<input type="text" name="feature-template[mytxt]" id="feature-template.mytxt" value="" autocomplete="off" />
inputSTRING(112): <input type="text" name="feature-template[mytxt]" id="feature-template.mytxt" value="" autocomplete="off" />
labelSTRING(15): Some text field
valueSTRING(0)
label.
tagSTRING(131): <label id='feature-template.mytxt_label' class='feature-template.mytxt_label' for="feature-template.mytxt">Some text field</label>

tag.
wrapSTRING(117): <label id='feature-template.mytxt_label' class='feature-template.mytxt_label' for="feature-template.mytxt">|</label>

htmlnameSTRING(23): feature-template[mytxt]
htmlidSTRING(22): feature-template.mytxt
htmlid.
withoutformidSTRING(5): mytxt

Now, a lot of template method are available on each data

upper() on the label: SOME TEXT FIELD

lower() on the label: some text field

ucwords() on the label: Some Text Field

wrap("This is before | and this is after".upper()) on the previous: THIS IS BEFORE Some Text Field THIS IS AFTER

Template methods allow conditioning some data

this condition is true

Now, it's also possible to condition the display of whole parts of the HTML using "perimeters"

This DIV will be displayed