[Zope] a newbie in trouble with tree tag and sql methods
Graham Chiu
anon_emouse@hotmail.com
Tue, 6 Jul 1999 00:13:55 +1200
In article <199907042001.NAA20866@zope.codeit.com>, Phillip J. Eby
<pje@telecommunity.com> writes
>At 07:52 PM 7/4/99 +0300, Lauri Posti wrote:
>>
>>and tree tag is:
>><!--#with "_.namespace(obj_id=0)"-->
>> <!--#tree branches_expr="query(param=obj_id)" single=0-->
>> <!--#var name-->,<!--#var obj_id-->
>> <!--#/tree-->
>><!--#/with-->
>
>Change to:
><!--#tree id=obj_id branches_expr="query(param=obj_id)" single=0-->
>
>And you should be fine. The problem is that without the id= setting, Zope
>doesn't know how to tell one object from another when expanding/contracting
>branches.
>
Well, encouraged by this, I've also attempted to use the tree tag/sql combination.
My table URL stores urls with userid, path, query string, and description of the url.
My sql query name: sqlTestTree argument: param
<!--#if "param==''"-->
select distinct userid as obj_id, '' as path, '' as qstring, '' as description from
url order by userid
<!--#else-->
select userid as obj_id, path, qstring, description from url where
<!--#sqltest param column=userid type=nb-->
<!--#/if-->
My dtml document is as follows:
<!--#with "_.namespace(obj_id='')"-->
<!--#tree id=obj_id branches_expr="sqlTestTree(param=obj_id)" single=0-->
<!--#if "path==''"-->
<!--#var obj_id-->
<!--#else-->
<a href=<!--#var path-->?<!--#var qstring-->><!--#var description--></a><br>
<!--#/if-->
<!--#/tree-->
<!--#/with-->
Unfortunately I can infinitely expand the tree whereas I want to stop it at one
expansion.
-------
Regards, Graham Chiu
gchiu<at>compkarori.co.nz