I'm missing something really basic
I've been using Zope for a couple of weeks now fairly intensely, and learning fast. But then I run into the most obvious question in the world, and I'm stumped (perhaps it's too obvious). I've scoured the documentation, but I can't find it. So here goes. How does a dtml document refer to the URL parameters passed to it? E.g., I have a top-level index_html dtml method containing: <dtml-var standard_html_header> <dtml-var content fmt=structured-text> <dtml-var standard_html_footer> and a dtml document 'content' at each level in my tree with stx. So far, so good. But now I want to pass two parameters to one of these 'content' document, as in http://localhost:8080/about/news?product=Xdata?newstype=review I can't for the life of me figure out how to get those two parameters. They don't seem to be in the context, and they're only in the REQUEST in the raw parameter string (which I guess I could parse). Is it because this is a non-forms document that I don't get the parameters? -- Cheers! Chris Ryland Em Software, Inc. www.emsoftware.com
--- Chris Ryland <cpr@emsoftware.com> wrote:
I've been using Zope for a couple of weeks now fairly intensely, and
That's the only way to do it 8^)
learning fast. But then I run into the most obvious question in the world, and I'm stumped (perhaps it's too obvious). I've scoured the documentation, but I can't find it. So here goes.
How does a dtml document refer to the URL parameters passed to it?
[snip]
http://localhost:8080/about/news?product=Xdata?newstype=review This is not a legal URL to pass multiple CGI query variables use (notice the ampersand): http://foo:8080/bar?var1=val1&var2=val2
I can't for the life of me figure out how to get those two parameters. They don't seem to be in the context, and they're only in the REQUEST in the raw parameter string (which I guess I could parse).
These values get added to the REQUEST object, which exposes them at the bottom of the namespace stack (REQUEST is the last place checked for names). So, you can either directly access them, or access them as attributes or items of the REQUEST object. for the above URL, the following lines would work: <dtml-var name="var1"> &dtml-var1; <dtml-var expr="REQUEST.var1"> <dtml-var expr="REQUEST['var1']"> The latter two are more explicit and would avoid namespace collisions. hth, ===== | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `-----------------> __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Hi, Am Donnerstag, 7. Juni 2001 02:49 schrieb Chris Ryland:
I've been using Zope for a couple of weeks now fairly intensely, and learning fast. But then I run into the most obvious question in the world, and I'm stumped (perhaps it's too obvious). I've scoured the documentation, but I can't find it. So here goes.
How does a dtml document refer to the URL parameters passed to it?
E.g., I have a top-level index_html dtml method containing:
<dtml-var standard_html_header> <dtml-var content fmt=structured-text> <dtml-var standard_html_footer>
and a dtml document 'content' at each level in my tree with stx. So far, so good.
But now I want to pass two parameters to one of these 'content' document, as in
Try: <dtml-var standard_html_header> <dtml-var "content(parameter1=value1,parameter2=value2)" fmt=structured-text> <dtml-var standard_html_footer> or try: <dtml-var standard_html_header> <dtml-call "REQUEST.set('parameter1','value1')"> <dtml-call "REQUEST.set('parameter2','value2')"> <dtml-var content fmt=structured-text> <dtml-var standard_html_footer> in both cases mark the different quotation marks ... - Holger
http://localhost:8080/about/news?product=Xdata?newstype=review
I can't for the life of me figure out how to get those two parameters. They don't seem to be in the context, and they're only in the REQUEST in the raw parameter string (which I guess I could parse).
Is it because this is a non-forms document that I don't get the parameters? -- Cheers! Chris Ryland Em Software, Inc. www.emsoftware.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ----------------------------------- catWorkX GmbH Dipl.-Ing. Holger Lehmann Stresemannstr. 364 22761 Hamburg Tel: +49 (0700) catWorkX Tel: +49 (40) 890 646-0 Fax: +49 (40) 890 646-66 mailto:lehmann@catworkx.de http://www.catworkx.de http://www.catbridge.de
Hi Chris, Well, this may just be an email typo, but I think there's a problem with your query parameter string. Try changing: http://localhost:8080/about/news?product=Xdata?newstype=review to: http://localhost:8080/about/news?product=Xdata&newstype=review Aside from the funny looking URL, I just tried duplicating it like this (notice the dtml-with tags): DTML Method "test" <dtml-var standard_html_header> Product type: <dtml-var product><br> News type: <dtml-var newstype><br> <hr> <dtml-with f1> <dtml-var content> </dtml-with> <hr> <dtml-var REQUEST> <dtml-var standard_html_footer> In folder "f1", below folder containing test, I have a DTML Method named "content": Product type: <dtml-var product><br> News type: <dtml-var newstype><br> Then I call it in the browser like this: http://localhost:8080/test?product=Xdata&newstype=review And everything renders nicely. Hope that helps. Eric.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chris Ryland Sent: Wednesday, June 06, 2001 5:50 PM To: zope@zope.org Subject: [Zope] I'm missing something really basic
I've been using Zope for a couple of weeks now fairly intensely, and learning fast. But then I run into the most obvious question in the world, and I'm stumped (perhaps it's too obvious). I've scoured the documentation, but I can't find it. So here goes.
How does a dtml document refer to the URL parameters passed to it?
E.g., I have a top-level index_html dtml method containing:
<dtml-var standard_html_header> <dtml-var content fmt=structured-text> <dtml-var standard_html_footer>
and a dtml document 'content' at each level in my tree with stx. So far, so good.
But now I want to pass two parameters to one of these 'content' document, as in
http://localhost:8080/about/news?product=Xdata?newstype=review
I can't for the life of me figure out how to get those two parameters. They don't seem to be in the context, and they're only in the REQUEST in the raw parameter string (which I guess I could parse).
Is it because this is a non-forms document that I don't get the parameters? -- Cheers! Chris Ryland Em Software, Inc. www.emsoftware.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Casey Duncan -
Chris Ryland -
Eric Walstad -
Holger Lehmann