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
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 that, and deliver it to the client. The adp page can use
the datasources defined in the Tcl page.
ad_return_template
-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
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
-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 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.