sequence- variables
How can I use the sequence variables for something other than rendering? I can do a <dtml-var sequence-number> and it will render the current sequence number just fine, but if I do a <dtml-if "sequence-number == numberVariable"> it barfs. It also barfs if I try to assign it to another variable. What am I doing wrong? Thanks, Rick
On Tue, Jun 11, 2002 at 12:16:27PM -0700, D. Rick Anderson wrote:
How can I use the sequence variables for something other than rendering? I can do a <dtml-var sequence-number> and it will render the current sequence number just fine, but if I do a <dtml-if "sequence-number == numberVariable"> it barfs. It also barfs if I try to assign it to another variable. What am I doing wrong?
You can't have the "-" char in a name, so you have to use this magic: <dtml-if "_['sequence-number'] == numberVariable"> ... </dtml-if> peace, Bo
On Tue, Jun 11, 2002 at 12:16:27PM -0700, D. Rick Anderson wrote:
How can I use the sequence variables for something other than rendering? I can do a <dtml-var sequence-number> and it will render the current sequence number just fine, but if I do a <dtml-if "sequence-number == numberVariable"> it barfs. It also barfs if I try to assign it to another variable. What am I doing wrong?
You're forgetting that everything in quotes in a dtml-if is implicitly a python expression, and dashes are illegal in python variable names. Python interprets that as "sequence MINUS number". There are a couple of solutions. Read this: http://www.zope.org/Documentation/ZopeBook/AdvDTML.stx ... in the section called DTML Namespace Utility Functions. -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
participants (3)
-
Bo Granlund -
D. Rick Anderson -
Paul Winkler