Hi All: I want to put a set <dtml-in> tag based on a select variable as such: <dtml-if "select=='All'"> <dtml-in get_all_users> <dtml-else> <dtml-in get_select_users> </dtml-if> but I keep getting an error. Can I do this? Regards, Todd
Todd Loomis wrote:
Hi All:
I want to put a set <dtml-in> tag based on a select variable as such:
<dtml-if "select=='All'"> <dtml-in get_all_users> <dtml-else> <dtml-in get_select_users> </dtml-if>
but I keep getting an error. Can I do this?
Regards, Todd
I'm sure you want this: <dtml-if "select=='All'"> <dtml-var get_all_users> <dtml-else> <dtml-var get_select_users> </dtml-if> <dtml-in> makes a loop over a list of objects it doesn't mean include! example: <dtml-in "objectItems()"> <dtml-var title> </dtml-in> Marcus
On Fri, 1 Mar 2002, Todd Loomis wrote:
Hi All:
I want to put a set <dtml-in> tag based on a select variable as such:
<dtml-if "select=='All'"> <dtml-in get_all_users> <dtml-else> <dtml-in get_select_users> </dtml-if>
but I keep getting an error. Can I do this?
Regards, Todd
Nope. But you can could have either two complete dtml-in loops, with conditional dtml-ifs around them. <dtml-if "select=='All'"> <dtml-in> .. </dtml-in> <dtml-else> <dtml-in> .. </dtml-in> </dtml-else> Or, probably better <dtml-in "_.test(select=='All', get_all_users(), get_select_users())"> .. </dtml-in> (I'm assuming that get_all_users and get_select_users are callable. If not, ditch the parens.) -- Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton Independent Knowledge Management Consultant
Todd Loomis wrote:
Hi All:
I want to put a set <dtml-in> tag based on a select variable as such:
<dtml-if "select=='All'"> <dtml-in get_all_users> <dtml-else> <dtml-in get_select_users> </dtml-if>
but I keep getting an error. Can I do this?
1) dtml-tags *MUST* nest proper 2) <dtml-in "_.test(select=='All', get_all_users(), get_select_users())"> is a good idea 3) you might also bind methods to REQUEST-variables like so: <dtml-call "REQUEST.set( 'filter_users', _.test(select=='All', get_all_users, get_select_users) )"> note missing parens and <dtml-in filter_users> </dtml-in filter_users> better though: <dtml-in "filter_users()"> </dtml-in filter_users> note the discussion of name- and expr- attributes in http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html 4) also possible: bind result to a REQUEST-var <dtml-if "select=='All'"><dtml-call "REQUEST.set( 'filterd_users', get_all_users() )"> <dtml-else><dtml-call "REQUEST.set( 'filterd_users', get_select_users() )"></dtml-if> <dtml-in filterd_users> ... </dtml-in filterd_users> -------------------------------------------------------------- hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299
participants (4)
-
hans -
Joel Burton -
Marcus Bergmann -
Todd Loomis