Forum OpenACS Q&A: evaluating a template from a string

File acs-tcl/tcl/def-procs.tcl has a lot of procs that are involved in returning error pages.

In DotLRN if ad_page_contract performs validation and ad_complain is called, ad_header_with_extra_stuff returns a custom build html page.

This page is outside the dotlrn 'scope'.

I would like to build a page that calls the default master in dotlrn (dotlrn-master) so that the error page seems to be within dotlrn.

Is it possible to build an ADP page that is evaluated and uses dotlrn-master as its master template?

Collapse
Posted by Claudio Pasolini on
You can
  1. create an ordinary adp file pointing it to dotlrn-master
  2. compile the template with:
    set code [template::adp_compile -file $path_to_adp]
  3. merge the template with your data sources with:
    set html [template::adp_eval code]
  4. output the error page with:
    ns_return 200 text/html $html