Forum OpenACS Q&A: Response to ad_return_template

Collapse
Posted by Lee Denison on
Originally adp templates were only parsed when ad_return_template was explicitly called at the end of the tcl script.  In more recent versions of OACS the handling of adp templates is implicit (ie if a correspoding adp file exists for the tcl file being evaluated, it gets evaluated immediately afterwards).  The ad_return_template function still exists for backwards compatibility and to allow you to specify a template other than the default.  With no arguments, ad_return_template is a noop.

The tcl file is still sourced first, but the search for a template is handled outside of the script itself.

Incidentally I think the default behaviour is inconvenient - if you create your adp templates under the www tree, along side your tcl scripts (the default place that is checked), then anyone can try to access the adp template directly by specifying an extension in the url.  The templates will typically break because they usually require data from the tcl script.  Perhaps by default it should check for an equivalent file under a templates dir instead of www?