This ought to be easy: <dtml-in> through a list of entries. Each entry has a string and a number which indicates its level of indentation, so "Root",0; "Main",1; "Sub",2 and so on. Presenting these in a SELECT input I want to show the indentation so it's easy to see and use. Obvious answer is to use characters to pad the values thus: <select> <dtml-in sequence> <option value="whatever"> <for loop=0 to entry-indent-value> </for> <entry-string-value> </dtml-in> </select> So where does Zope hide its FOR loop? Can't find the bugger anywhere! ---------------------- Andy Gates, Learning and Research Technology Andy.Gates@bristol.ac.uk - ICQ#74362415
+----[ Andy Gates ]--------------------------------------------- | This ought to be easy: ... | Presenting these in a SELECT input I want to show the indentation so | it's easy to see and use. Obvious answer is to use characters | to pad the values thus: You have to drop to the python level I'm afraid... | | <select> | <dtml-in sequence> | <option value="whatever"> | <for loop=0 to entry-indent-value> <dtml-in "_.range(entry_indent_value)"> | </dtml-in> | </for> | <entry-string-value> | </dtml-in> | </select> | | So where does Zope hide its FOR loop? Can't find the bugger anywhere! You can find these things... you just have to know what you're looking for... -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
Andy Gates wrote:
<select> <dtml-in sequence> <option value="whatever"> <for loop=0 to entry-indent-value> </for> <entry-string-value> </dtml-in> </select>
So where does Zope hide its FOR loop? Can't find the bugger anywhere!
You already did. <dtml-in> is FOR. As in Python's "for v in list". Use <dtml-in "_.range(0, _['entry-indent-value']"> </dtml-in> Phill
Hi Andy, Zope, and python for that matter, have no for loops ;-) Try this (untested, someone please correct errors ;-): I'm assuming stringthing (eg "Root") and numberthing (eg 0) are attributed of the objects in your sequence list. <select> <dtml-in sequence> <option value="<dtml-var stringthing>"> <dtml-var "' ' * numberthing"> <dtml-var numberthing> </option> </dtml-in> </select> cheers, Chris
participants (5)
-
Andrew Kenneth Milton -
Andy Gates -
Chris Withers -
Marcel Preda -
Phill Hugo