[Zope] Arguments to DTML methods

coder@kanga.nu coder@kanga.nu
Fri, 14 Jan 2000 12:47:04 -0800


Given that DTML methods don't accept arguments, is there a simple
way to work around passing custom data to a DTML method?

I currently have a number of DTML methods that encapsulate HTML
fragments (mostly table segemts) that I use often in almost macro
fashion.  I've broken them out into their own methods as I use the
same fragments across mutliple templates folders etc.  The text in
the HTML segments needs to passed in for each invocation (eg table
headers, cel values, etc).  Currently I'm wrapping all calls to the
DTML method in dtml-let's to define the arguments for the called
DTML method:

  Given a DTML method called, "custom_segment" which looks something
  like:
            
              ...yada...
              <dtml-var custom_text>
              ...yada...

  I invoke it as follows:

              <dtml-let custom_text="'this is some text'">
                <dtml-var custom_segment>
              </dtml-let>

This is pretty hokey, especially when I invoke "custom_segment" half
a dozen times in a single template or method.  Is there a better
way to fake passing arguments to a DTML method?  

-- 
J C Lawrence                              Internet: claw@kanga.nu
----------(*)                            Internet: coder@kanga.nu
...Honorary Member of Clan McFud -- Teamer's Avenging Monolith...