- YASQ (yet another stupid question)
(Yet Another Stupid Question)... I've got 1.9 running fine and have been able to get some dynamic happening using mysql. The one major snag I've run into is this: Say you have an external method, or a SQL Method that accepts a parameter. You want that parameter to be dynamic (possibly based on a field from a DB). How can you pass a dynamic parameter to a method from within DTML? i.e.: <!--#in expr="getSpam(cost=<!--#var spamcost-->)"--> I know I'm not wording this in the best way possible. Please excuse me. I've been fiddling with it for about an hour now, and I can't make any headway. Thanks in advance, Chad Fowler
At 02:55 PM 12/23/98 -0600, Chad Fowler wrote:
Say you have an external method, or a SQL Method that accepts a parameter. You want that parameter to be dynamic (possibly based on a field from a DB). How can you pass a dynamic parameter to a method from within DTML?
i.e.: <!--#in expr="getSpam(cost=<!--#var spamcost-->)"-->
What you've got is basically right, it's just a question of syntax. In general you can refer to variables defined in the REQUEST by name: <!--#in expr="getSpam(spamcost)"--> Sometimes there are problems with this, if for example you want access to special sequence-item variable. In these cases you can lookup variables in the namespace mapping object (whose unpronounceable name is written '_') like so: <!--#var expr="getSpam(_['spamcost'])"--> For an example of how to use this namespace feature to include random bits of content see: http://www.zope.org/Documentation/HowTo/RandomContent You should also check out the DTML Users Guide which spells out pretty well how to use DTML: http://www.digicool.com/site/Principia/DTML.html Hope this helps. And BTW, DTML *is* complex; your question is not stupid. -Amos
participants (2)
-
Amos Latteier -
Chad Fowler