Samples

Templating System : Demo
As the links reveal, the "Data" files have the extension .tcl and the "Template" files have .adp. If you want to see a little behind the scenes, you can look at the tcl code into which we compile the template. The last column will deliver the resulting page to your browser.

Mechanisms underlaid in red are known to not work.

General

Description Data Template Compiled
Template
Output
Simple variable substitution View View View View
Using bind variables in your query View View View View
A plain Tcl page that returns its own output View None None View
Conditional Expressions View View View View
Comments None View View View

Combining templates

Description Data Template Compiled
Template
Output
Include a template within another template View include
included
include
included
View
Wrap a page within a master template None Slave
Master
Slave
Master
View
Using the default master None View View View
Include with master and recursion.
Remember Fibonacci from pset 1, exercise 1?
Start
Included
Master
Start
Included
Master
Start
Included
Master
View

Embedded Tcl

Description Data Template Compiled
Template
Output
Tcl escape with implicit output View View View View
Tcl escape with explicit output None View View View
Template chunks within escaped Tcl code blocks View View View View
Puts (if you absolutely must) View View View View

Iteration

To see the following examples with different data, you can enter additional users into the sample table with "a simple form" or change them with "editing: several pages in one" in section
Using the Form Manager below.
Description Data Template Compiled
Template
Output
Repeating template chunks for each row of a query result View View View View
Generating the multirow datasource in TCL View View View View
Repeating template chunks for each row of a query result, with custom manipulation of data View View View View
Repeating template chunks with grouping View View View View
Repeating template chunks as cells of a grid View View View View
Repeating template chunks for each element of a list View View View View

Both Iteration and Composition

Description Data Template Compiled
Template
Output
Apply different skins to the same data View Plain
Fancy
Plain
Fancy
Plain
Fancy
Absolute
Passing a multirow datasource to an included page View Outer
Included
Outer
Included
View
Processing a template from a string (not file) View View View View

Forms

Description Data Template Compiled
Template
Output
Using ad_page_contract Target Form
Target
Error Page
Form
Target
Error Page
Form
Target
 
Report an error related to a request. View View Plain View

Using the Form Manager.

Description Data Template Compiled
Template
Output
A simple form View View View View
A form with button groups View Simple
Gridded
Simple
Gridded
Simple
Gridded
A form with Select widgets View View View View
Custom validation of a request View View View Inline Error Message
Sitewide Error Page
Valid Request
A form with the Date widget View View View View
Editing: several pages in one View View View View
A form with a custom confirmation page View Submit
Confirm
Submit
Confirm
View


templating@arsdigita.com