Forum OpenACS Q&A: Response to returning pages in "chunks"

Collapse
Posted by Andrew Piskorski on
Tom, sure, it works. You'll want to use template::adp_parse rather than ns_adp_parse, though.

Then you just have to make sure you split up all the master templates you're going to be calling into separate "top" and "bottom" templates. E.g., for the typical case where you have a master for your package, and then a site-wide default-master as well, you'd have something like:

In /packages/my-package/www/my-page.tcl:

set this_dir [file dirname [ad_conn file]]
set template_file "$this_dir/master-top"
set template_top [template::adp_parse $template_file [list title $title context_bar $context_bar]]

In /packages/my-package/www/master.adp:

<include src="master-top" title="@title@" context_bar="@context_bar@">

<slave>

<include src="master-bottom" right_side_sig="@right_side_sig@">

In /packages/my-package/www/master-top.adp:

<master src="/www/default-master-top">
<property name=focus>@focus@</property>
<property name=title>@title@</property>
<property name=context_bar>@title@</property>

<h2>@title@</h2>
@context_bar@
<hr>

<slave>

You get the idea... Only mildy annoying to do, at worst.