Forum OpenACS Q&A: Response to Porting of dynamic queries

Collapse
Posted by Vinod Kurup on
What do I put in the partialquery section for the $extra_where

I believe you can just keep $extra_where in the .xql file. When the interpreter comes along a db_map call, it reaches out to the proper .xql file, grabs the partialquery snippet and evaluates it in the scope of the .tcl script. So $extra_where will be replaced by whatever $extra_where was up until that point in the .tcl script.(Note: that's how I conceptualize it happening - not sure if that's exactly how it really happens)

A brief example:

.tcl if { ![template::util::is_nil extra_where] } { append query "[db_map extra_where_snippet]" } .xql < partialquery name="extra_where_snippet"> < querytext> and $extra_where < /querytext> < /partialquery>