[Zope] A newbie question, rephrased

John Morton jwm@plain.co.nz
Wed, 23 Feb 2000 12:09:12 +1300 (NZDT)


Carlson, Christopher W. writes:
 > It seems that I may have been a little obscure.  Let me try again:
 > 
 > First off, I'm new to Zope.  I've read through the documentation (well, I
 > stuck with it for as long as I could) and can do a couple basic tasks, but
 > in my struggle to convert a web site from its current Apache/PHP incarnation
 > to Zope I have hit a snag.
 > 
 > While I'm able to create Z SQL Methods and subsequently use the Search
 > Interface Wizard, I'd like to be able to do the following:
 > 
 > While looping through the results of an SQL method, I'd like to call another
 > method using a value ('id') from the outer loop/method call as an argument.
 > I don't appear to be able to nest DTML tags, so putting a <dtml-var ....>
 > tag inside the call to the second method won't work.

Try this:

<dtml-in "sql_first_method(arg=value,...)">
 <dtml-comment>A new namespace is made by dtml-in and names of the
 columns selected by sql_first_method are accessible properties - ie 
 <dtml-var id> will be the id for the current row.
 <dtml-in "sql_second_method(arg=id,...)">  
    <dtml-comment>The second method is called with the id from the
    first one as an argument. If it returns one row, we're here only
    once. I think <dtml-with> might work, too.
    </dtml-comment>
 </dtml-in>
</dtml-in>

John.