RE: [Zope] Building a page from multiple paramatised queries
A few bits of advice for you: 1) Never use an SQL key of ID with Zope. It could lead to a namespace collision, as id is a zope term referring to an objects id. You probably haven't had a problem _yet_, as ZSQL methods use the REQUEST namespace almost (there are some unusual instances) exclusively. I usually prefix it with something like "sql_" so I get "sql_Id". 2) To get SQL data from REQUEST explicitly, use <dtml-var expr="REQUEST.sql_variable_name"> (or is it <dtml-var expr="REQUEST.sql_variable_name()">) Try something like this: ### FeatureDetail ### <dtml-var name="standard_html_header"> <dtml-in name="FeatureDetailQuery"> <h1><dtml-var name="Name"></h1> <dtml-in name="Query2"> <p> <dtml-var name="bosco"> </p> </dtml-in> </dtml-in> ### FeatureDetailQuery ### SELECT * FROM Feature WHERE <dtml-sqltest sql_Id op="eq" type="int"> ### Query2 ### SELECT bosco FROM Fishsticks WHERE <dtml-sqltest sql_Id op="eq" type="int"> Note also that in my above FeatureDetail, if FeatureDetailQuery returns more than one row of data, you will get something like: <h1>SOme name</h1> <p> Stuff </p> <h1>Some other name</h1> <p> More stuff </p> Troy -----Original Message----- From: Giles Chamberlin [mailto:GChamberlin@Ridgeway-Sys.com] Sent: Tuesday, August 07, 2001 6:06 AM To: 'zope@zope.org' Subject: [Zope] Building a page from multiple paramatised queries 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? Giles Chamberlin
participants (1)
-
Farrell, Troy