renderer:TEMPLATE

Takes a template file as an input and inserts the rendered elements by substituting markers like {my_marker} with the corresponding HTML.

 

Each renderlet renders it's full layout ; the produced HTML will be accessible using the syntax {my_renderlet_name} (the renderlet's name wrapped in curly braces).

 

Each {marker} might have sub-properties available. You are able to display them selectively using the dotted-notation {marker.my_sub_property}.

 

Each {marker} also defines template-methods you may use inside your template. For instance, to list all the sub-properties available on a {marker}, use the debug method: {marker.debug()}.

 

This is called channelled-templating; some examples below demonstrate the concept.

Reference

Go to Top
path data type req def uobj description
template/
template/namestring; file-path
  
 
  
The path to your HTML template file. May be an EXT-prefixed path.
template/subpartstring
  
 
  
The template marker to cut, inside the template file. Example:
  1. <template
  2. path="EXT:myext/template.html"
  3. subpart="###MYFORM###"
  4. />
And the corresponding HTML, inside the template:
  1. <!-- ###MYFORM### begin-->
  2.  
  3. <h2>Here, the content of your HTML template subpart</h2>
  4.  
  5. <!-- ###MYFORM### end-->
template/errorTagstring  
  
This is the name of the tag that Formidable will use to store the error-messages generated by validators. It will be available for use in your template. Example:
  1. <errorTag>myerrortag</errorTag>
For instance, with myerrortag defined as the error-tag, and fields mytxt1 and mylist2 having errors, you may display the errors by using, in your HTML:
  1. {myerrortag}

If you want to wrap the error messages in a nice HTML structure that has to show up only when there are errors to display, you may use the .cssdisplay property of the error-tag. In our case,
  1. <div style="display: {myerrortag.cssdisplay};">
  2. <p>Some fields have not been correctly completed:</p>
  3. <span style="color: red;">{myerrortag}</span>
  4. </div>
Now if you need to display each error message individually, lets say, close to it's renderlet, you'll have to use the template-channels available for each renderlet on your errortag.
  1. {mytext1}
  2. {myerrortag.mytxt1.tag}
  3. </p>
  4.  
  5. {mytext2}
  6. {myerrortag.mytxt2.tag}
  7. </p>
Reminder:
To know what is available at template-level on a marker, use the debug() method, like this:
  1. {myerrortag.debug()} or {myerrortag.mytxt1.debug()}
template/clearMarkersNotUsedboolean true  True, the unreplaced {tags} will be deleted before display. False, they won't.
htmlstring  
  
If you don't want to create a template file, you may define the HTML in a CDATA inside the /html property.
beforeDisplayrunneable  
  
Allows to alter the renderer HTML parts before passing them to the template
  • Input: the rendered HTML-parts array,
  • Output: the altered rendered HTML-parts array.

Examples

Go to Top