Forum OpenACS Q&A: Re: -query swith in ad_page_contract

Collapse
Posted by Jim Lynch on
Personally, when I first saw ad_page_contract it confused me... when I first saw -query, it undid all confusion and I use it every time.

CoreGuysnGals: pls don't get rid of it... imo, it goes to documentation

Collapse
Posted by Dave Bauer on
Jim. you might be right, but there are thousands of Tcl files without it, and few with it in the current code.

I suppose one could write a script to fix it, if one was so inclined.

I don't have an opinion either way.

Collapse
Posted by Brian Fenton on
Hi Jim,

can you give a simple example of how you use it?

thanks!
Brian

Collapse
Posted by Jim Lynch on
(from Brian Fenton: Jim, can you give a simple example of how you use it)

Brian, sure.

So if you use ad_page_contract without it, then you need two parameters like this

ad_page_contract { docs go here } { variables coming into the page (aka the query) go here } and other switches go here

example of "and other switches", I might use -properties, like this:

ad_page_contract { docs } { incoming } -properties { outgoing }

I like to use it this way:

ad_page_contract { docs } -query { incoming vars }

or if I want to document the vars available to the .adp:

ad_page_contract { docs } -query { incoming } -properties { outgoing vars }

-Jim

Collapse
Posted by Brian Fenton on
Cheers Jim. I must start using the -properties more often. Good advice!
Collapse
Posted by Dave Bauer on
-properties sounds like a good idea :) Most modern openacs code doesn't use it as the common design pattern is for the ADP designer to be the same person as the Tcl programmer, in my experience.

Also there was some dreamed of feature to show the properties somehow in the documentation, that would be interesting.

Collapse
Posted by Brian Fenton on
"ADP designer to be the same person as the Tcl programmer"

AND the DBA, the sysadmin, the network guy plus office security 😉

Collapse
Posted by Steve Manning on
Wow you have someone else to make the tea? I'm jealous :)