Index: openacs-4/packages/acs-templating/www/doc/developer-guide.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/developer-guide.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/doc/developer-guide.adp 27 Oct 2014 16:40:13 -0000 1.2 +++ openacs-4/packages/acs-templating/www/doc/developer-guide.adp 7 Aug 2017 23:48:02 -0000 1.3 @@ -1,21 +1,26 @@ -{/doc/acs-templating {Templating}} {Template System Guide} +{/doc/acs-templating {ACS Templating}} {Template System Guide} Template System Guide - - -

Programmer / Developer Guide

Templating System : Developer Guide +

Programmer / Developer Guide

+Templating System + : Developer Guide

Mini How To

-Start a Tcl page as usual with ad_page_contract. Be -sure to pass a -properties block; this signals the use -of templating. The tcl page should fill the data sources you + +Start a Tcl page as usual with ad_page_contract +. Be +sure to pass a -properties + block; this signals the use +of templating. The Tcl page should fill the data sources you promised in the contract, and not write to the connection. At the -end of your tcl page, call ad_return_template. The +end of your Tcl page, call ad_return_template +. The template system will look for an adp page with the file name stub -you indicate (defaulting to the same stub as the tcl page), process +you indicate (defaulting to the same stub as the Tcl page), process that, and deliver it to the client. The adp page can use the -datasources defined in the tcl page. -

Guide

    +datasources defined in the Tcl page. +

    Guide

    +
    1. User Guide
      • Overview
      • Establishing data sources
          @@ -40,7 +45,8 @@ types
      • Handling errors -
        • See the "contract", "error", and "state" demos.
        +
        • See the "contract", "error", and +"state" demos.
    2. Object and API Reference
        @@ -52,34 +58,44 @@ in memory
    3. -

    API

    +
+

API

+ After the script for a page is executed, acs-templating processes the template, interpolating any data sources and executing the special tags. The resulting HTML page is written to the connection (i.e., returned to the user).
ad_return_template
-Normally, does nothing at all. With the -string option + +Normally, does nothing at all. With the -string + option you get the resulting HTML page returned as a string.

The optional template argument is a path to a page -(tcl/adp file pair). Note that you don't supply the ".tcl" or -".adp" extension. It is resolved by help of -template::util::url_to_file (with the current file -stub as reference path) and passed to +(tcl/adp file pair). Note that you don't supply the +".tcl" or ".adp" extension. It is resolved by +help of template::util::url_to_file (with the current +file stub as reference path) and passed to template::set_file, to change the name of the page -being served currently. If it starts with a "/", it is taken to be -a path relative to the server root; otherwise it is a filename -relative to the directory of the tcl script.

ad_page_contract
+being served currently. If it starts with a "/", it is +taken to be a path relative to the server root; otherwise it is a +filename relative to the directory of the Tcl script.

+
ad_page_contract
+ Normally, complaints about incorrect parameters are written directly to the connection, and the script is aborted. With the -option -return_errors you can name a variable into +option -return_errors + you can name a variable into which to put any error messages as a list, and -ad_page_contract will return in any case. You can then +ad_page_contract + will return in any case. You can then present the errors to the user in a templated page, consistent with -the look and feel of the rest of your service. If there's no -complaint, ad_page_contract won't touch the variable; -typically it will stay undefined. -
Christian -Brechbühler
-Last modified: $Id: developer-guide.html,v 1.3 2004/02/10 12:16:40 -joela Exp $ - +the look and feel of the rest of your service. If there's no +complaint, ad_page_contract + won't touch the +variable; typically it will stay undefined. +
+
Christian +Brechbühler
+ +Last modified: $‌Id: developer-guide.html,v 1.4.2.1 2017/04/22 +18:30:26 gustafn Exp $