[Zope] Tree tag and SQL methods?

Phillip J. Eby pje@telecommunity.com
Fri, 25 Jun 1999 14:55:34 -0500


Same problem as before.  Try:

<!--#with "_.namespace(pub='')"-->
<!--#tree branches_expr="Query(pub=pub)"-->
<!--#/tree-->
<!--#/with-->

And have Query return the "select distinct" of publications as 'pub' if the
pub parameter is '', otherwise return the titles for that publication, and
return pub as some value that will result in no results if fed back into
the query.


At 07:43 PM 6/25/99 +0200, Alexander Staubo wrote:
>I haven't tested this yet, but it seems sound; I'll let you know if it
>doesn't. :-)
>
>Now perhaps you can assist in another similar case with the #tree tag.
>
>Basically I have a two-level hierarchy of (simplified) articles and
>their home publication. The article database might be something like
>this:
>
>	Title:	Publication:
>	Foo	Bar Mag
>	Bar	Fnargh Times
>	...
>
>I seek to render a "tree" where the publication is the tree node, and
>the list of articles (by their title) are listed under each node. A
>little like the "Quick Start" thing. Click on the "plus" icon beside the
>publication and you get a (non-tree) list of articles. Actually I get
>this is, strictly speaking, a one-level hierarchy.
>
>While this structure is simple enough that could stay clear of using the
>#tree tag, I'd still like to try. I tried:
>
><!--#tree expr="Query()" leaves="Leaf"-->
>  <!--#var Publication--><br>
><!--#/tree-->
>
>thinking that Query() would return the publications, and each
>publication would use the DTML Method Leaf to render its contents, but
>no. What am I missing?