![]() |
| Frontier Tutorials / Writing Table Renderers / What Is A Table Renderer |
Subtables in a website are normally rendered as subdirectories within the site. However, Frontier allows you to render all subtables in a particular website table as individual pages, instead, by specifying a table renderer, using the #renderTableWith directive.
When #renderTableWith is defined in a particular table, the website framework will not create subdirectories from subtables of the table. Instead, it will call the specified table renderer for every subtable in the table.
Conversely, all subtables in the table will be rendered by the same render script.
#renderTableWith may contain the name of the script to be called to render the tables. This script may be placed directly in the website table (at any level where it will be visible as a directive), in the #tools table, or in user.html.renderers. Alternately, #renderTableWith may be set to the address of a script anywhere in the ODB.
For example, when the following website is rendered, the HTML framework will call ["#tools"].renderTableAsEvent to render each subtable in the comingEvents table (i.e., event001, event002, etc.). The rendered text returned by this script becomes the bodytext, and is substituted in turn into the page template (#template).
mySite
#template
#tools
renderTableAsEvent [script]
default
comingEvents
#renderTableWith = "renderTableAsEvent"
default
event001
date
time
name
description
event002
date
time
name
description
event003
date
time
name
description
NOTE: UserLand's documentation of the #renderTableWith directive indicates that the renderer may be an outline, as described below. However, at the time of this writing, html.tenderRender will only accept the address or name of a script in this directive; otherwise, it throws a scriptError.
#renderTableWith may, instead, contain the name of an outline that will be rendered by the website framework as the page. The outline serves as the page content template for the subtables. This outline may be placed directly in the website table (at any level where it will be visible as a directive), in the #tools table, or in user.html.renderers.
|
|---|