Re: [Zope] Peculiar effects with SQL tree
On Tue, 8 Feb 2000 16:48:58 -0000 Stephen Harrison <stephen@nipltd.com> wrote:
I have a dtml-tree which is getting its tree data from an sql method: ... However, with only a small amount of data in the tree table this is behaving in a very strange way...
I had similar problems with I set up a tree over an SQL method. I don't recall exactly how I fixed it, but I can show you what I have: DTML Method: <dtml-let CatID="0"> <dtml-tree id=CatID branches_expr="CatCats(CatParent=CatID, Approved=1)"> <dtml-if "_.int(CurrCat) - _.int(CatID)"> <dtml-var PrintCat> <dtml-else> <b><<<dtml-var PrintCat>>></b> </dtml-if> </dtml-tree> </dtml-let> SQL: SELECT * FROM Categories <dtml-sqlgroup where> <dtml-sqltest CatParent type=int> <dtml-and> <dtml-if "_.int(Approved) == 1"> <dtml-sqltest Approved type=int> </dtml-if> <dtml-if "_.int(Approved) == -1"> Approved=0 </dtml-if> </dtml-sqlgroup> ORDER BY CatName PrintCat is a DTML method that displays the data on the current node. CatParent is the table field that points to parents of nodes. CatID is the field that holds the ID of the current node (which may be pointed to by some CatParents). You can ignore all the logic around "Approved" (I have nodes that aren't always visible). The business with CurrCat is an attempt to highligh the currently selected node in the tree. -- J C Lawrence Home: claw@kanga.nu ----------(*) Other: coder@kanga.nu --=| A man is as sane as he is dangerous to his environment |=--
I had similar problems with I set up a tree over an SQL method. I don't recall exactly how I fixed it, but I can show you what I have:
Thanks for the help. I tracked down the problem to the following bit of code:
<dtml-tree id=CatID branches_expr="CatCats(CatParent=CatID, Approved=1)">
To use your example, I had id='CatID' rather than id=CatID. I had got this from an old mailing list message which refered to Anthony Baxters HowTo: http://www.zope.org/Members/anthony/tree-coding-tricks citeing the quotes as a correction to the code in the howto. Ho hum... Cheers, Stephen -- Stephen Harrison - stephen@nipltd.com New Information Paradigms - www.nipltd.com
participants (2)
-
J C Lawrence -
Stephen Harrison