[Zope] Building a page from multiple paramatised queries

Dieter Maurer dieter@handshake.de
Tue, 7 Aug 2001 23:16:50 +0200 (CEST)


Giles Chamberlin writes:
 > I'm a zope novice so I'm probably missing something obvious.  My intent is
 > to build a web page from the results of two queries, each of which are
 > paramatised by the same value.
 > 
 > I've got a single query working fine:
 > 
 > FeatureDetailQuery has a parameter ID and SQL:
 > select * from Feature where <dtml-sqltest Id op=eq type=int>
 > 
 > FeatureDetail is a simple web page:
 > <dtml-var standard_html_header>
 > <h1><dtml-var Name></h1>
 > <dtml-var standard_html_footer>
 > 
 > and I bind the two together by referencing them with the a href =
 > FeatureDetailQuery/Id/<dtml-var Id>/FeatureDetail
 > 
 > All's well.  My problem is that I want to add the output of another query,
 > also parametised by Id to the same web page and I'm stumped as to how to go
 > about it.  Any suggestions?
You go strange ways....

  The natural way would be:

    Make a page that calls both queries, like that:

      myPage:

	....
        <dtml-with "FeatureDetailQuery()[0]">
	  <dtml-var Name>
	</dtml-with>
        <dtml-with "OtherQuery()[0]">
	  <dtml-var Name>
	</dtml-with>
	....

  But, of course, you can also integrate the second query
  in your "FeatureDetail". It's only a bit convoluted....

     FeatureDetail:
       ....
       <dtml-var Name>
       <dtml-with "OtherQuery()[0]">
	 <dtml-var Name>
       </dtml-with>
       ....
       

Dieter