Index: openacs-4/packages/acs-templating/www/doc/guide/data.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/data.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-templating/www/doc/guide/data.html 13 Mar 2001 22:59:27 -0000 1.1 +++ openacs-4/packages/acs-templating/www/doc/guide/data.html 7 Aug 2017 23:48:03 -0000 1.2 @@ -18,44 +18,44 @@

The templating system can manipulate four basic types of structures as data sources:

- +
- - + - -
onevalue A simple scalar, such as a user's +
onevalue A simple scalar, such as a user's first name or the total due on a purchase order.
onelist A list of simple scalars.
onelist A list of simple scalars.
onerow A one-row data table, with values in +
onerow A one-row data table, with values in one or more columns.
multirow A multi-row, multi-column data +
multirow A multi-row, multi-column data table.
-

onevalue

+

onevalue

-

onevalue data sources are implemented simply by setting a +

onevalue data sources are implemented simply by setting a Tcl variable:

set name "Walter Cronkite" -

The query procedure may be used to set a onevalue data +

The query procedure may be used to set a onevalue data source based on a database query:

query name onevalue "select name from users where user_id = 123" -

You can embed a onevalue data source in a template with +

You can embed a onevalue data source in a template with simple variable substitution.

-

onerow

+

onerow

-

onerow data sources are implemented as Tcl arrays:

+

onerow data sources are implemented as Tcl arrays:

set name(first_name) Walter
set name(last_name) Cronkite
-

The query procedure may be +

The query procedure may be used as a convenient way to store the result of a one-row database query into an array:

@@ -67,50 +67,50 @@ where user_id = 123" -

You can embed references to column values of a onerow +

You can embed references to column values of a onerow data source in a template with simple variable substitution.

-

onelist

+

onelist

-

onelist data sources are implemented by creating a Tcl +

onelist data sources are implemented by creating a Tcl list:

set names [list "Walter" "Fred" "Susy" "Frieda"]
-

The query procedure may be used to set a onelist data +

The query procedure may be used to set a onelist data source based on a one-column database query:

query name onevalue "select name from users" -

You can iterate over a onelist data source in a template with +

You can iterate over a onelist data source in a template with the list tag.

-

multirow

+

multirow

-

multirow data sources are not represented by a single Tcl +

multirow data sources are not represented by a single Tcl data structure. As such the templating system includes a special API for constructing and manipulating them.

multirow create cars make model year
 multirow append cars "Toyota" "Camry" "1996"
 multirow append cars "Volvo" "960" "1995"
-

The query procedure may +

The query procedure may be used as a convenient way to store the result of a multi-row, -multi-column database query into a multirow data source:

+multi-column database query into a multirow data source:

query name multirow "
   select 
     make, model, year
   from 
     cars"
-

You can iterate over a multirow data source in a template with +

You can iterate over a multirow data source in a template with the multiple tag.


-templating@arsdigita.com +