Re: [Re: [Zope] Re: [Re: [Zope] can dtml methods take arguments ?]]
Heiko Stoermer <heiko@mig.net> wrote:
The name "method" suggests that DTML methods should be able to take arguments much like ZSQL methods can. But for the life of me I can't find where these are added.
Well, just use them ;)
Sorry Andreas, I'm feeling a bit stupid here. You say to just use them so I've been trying variations without any luck.
If he says "just use them" he means that a DTML method can automatically see all the variables that are available in the calling document.
Aaah, NOW I get it. Yowzers, I'm starting to see the power of them and look at it in an entirely different light. This also changes the way that I've been programming things. (I'm sure this will happen a dozen more times too as Zope starts to sink in).
And thus, by simply using the names, you get what you need.
Great. This worked. I simply added the property 'mywidth' to the DTML document and set its value to 500. This DTML document contained a DTML method which could then use the value of mywidth. And by testing for the non-existence of the property, I could set a default value. So that answered both of my questions. Thank you very much !!
What might confuse you is the term "parameters". It's not what you'd > expect when thinking of "formal parameters" such as 'f(int i, float g)' or > similar in C. Just think of it as global variables that are visible in your method.
Yes, this namespace is a lot larger than I realised.
Now, enough of philosophy: to see how you can influence these variables available to your method just see the DTML-Guide, looking out for the section about the "let" statement or scanning it for the term "REQUEST.set".
Actually, I didn't need either of those using the method I described earlier. But you're right. I hadn't thought of using the REQUEST object for passing variables between different objects, although I'm sure I could abuse this too.
In this case the documentation contains everything you need (I've not been all that lucky while working with zope...) .
You're right. The documentation DOES contain it all. I've just been a bit overwhelmed and have to admit that I misinterpreted some of the documentation. (That said, the Zope team have to be highly commended on the documentation, especially as it must be difficult to keep up with the technical developments.) Henry. ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=1
participants (1)
-
happyrhinoï¼ usa.net