Forum OpenACS Development: Re: ad_page_contract to be used on includes
The goal, I think is to allow reusable forms. Allowing ad_page_contract to be used on includable forms is useful.
I think fixing a shortcoming in ad_page_contract is not a bad thing. I definitely think that it can be accomplished without breaking any existing code.
We have to remember that ACS 4 that OpenACS is based on was never finished, and there will definitely be places where we can improve on what we started with. As more and more developers use OpenACS to built real web sites, they will find things that can be improved.
ad_page_contract also serves to provide consistent documentation of tcl/adp pages. I think just that feature is worth using on includable pages, besides the other benefits.
I have written several 'includes' that use ad_page_contract and expect to find the variables in the form data. I find this behavior to be useful, logical, and consistent.
I appreciate Dave and Jun's intentions, but I agree with Tom. I think it would be better to either add an explicit switch to ad_page_contract or implement a different command that handles variables passed to an include.
My 2 centavos... =)
I never said don't use ad_page_contract for documentation purposes. But it sounds to me like you have a page which is designed to be accessed normally, and then you decide to include it in some other page. _If_ it is an include, write it like one, in other words, write a wrapper around the include. Now you have provided documentation on how to include the tcl/adp pair in other templates.
It might also be nice in this case to pass in the .adp template that should be used like:
<include src="myfile" var="val" template="mytemplate" > # then in the include: ad_return_template $template
Now everyone knows they can include 'myfile', and they can use their own template on top of that!