Forum OpenACS Q&A: Adptag procs are not beeing called on every request

I've been toying around with a custom adp tag, which I've implemented through the "template_tag" proc (though the same thing occur when I rewrite it directly for "ns_register_adptag").

Basically, the thing works perfectly the first few times after restarting the server, but after having reloaded the same page five times or so, the tag is being recognized (that is, removed from the adp script) but no being processed (the proc which is supposed to be called, well, isn't called).

I've debugged this by placing as "ds_comment" in the beginning fof all the procs being created by "template_tag" -- and it seems that none of the template_tag_* procs are being called (that is, the procs for handling such tags as <master> <property>...).

In any case, this seems magical to me, since everything by my own proc isn't suffering from not being called. Is the rp caching stuff, which means that I *must* use "template::adp_append_code" to make everything work -- or am I just misunderstanding something?

Thanks,
Steffen
AOLserver/4.0.10

Collapse
Posted by Jeff Davis on
an adp page is compiled once per thread and the tags themselves emit tcl code. You see it invoked for each thread (which is why you see it called 4 or 5 times) but then once the template is compiled the tag is no longer invoked.

If you touch the source .adp it will recompile it again so if you are working on the tag thats probably the easiest way to ensure it gets invoked when you change it.

The best place to start with what is admittedly a pretty dark art is to look at the existing tags, or turn on developer support which will include links in the footer to the compiled version of each template (the little "c" link).

Thanks Jeff,

I realized after writing my own question that I needed to add all the code in the tag proc, through "template::adp_append_code" -- and that did the trick. But thank you for explaining why it actually didn't work!

/Stc