Thanks for the reference to the DTML Guide...it has helped a lot. I have come across something that I couldn't seem to find an answer to. I have the following line in my original code that I uploaded from an existing HTML directory...I can't seem to find a dtml tag that will replace the echo statements here... href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80/ <!--#echo var="><!--#echo var="REQUEST_URI" -->;weblint" I found this snippet of code for an echo and set, but my attempts at modifying it to work for this have failed. <!--#call "REQUEST.set('varName', 'varValue')"--> <!--#var varName--> Thanks in Advance, Jessica
At 12:51 pm -0600 14/3/00, jessica lee tishmack wrote:
Thanks for the reference to the DTML Guide...it has helped a lot. I have come across something that I couldn't seem to find an answer to. I have the following line in my original code that I uploaded from an existing HTML directory...I can't seem to find a dtml tag that will replace the echo statements here...
href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80/ <!--#echo var="><!--#echo var="REQUEST_URI" -->;weblint"
Normally I'd say try, href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 /<dtml-var "REQUEST['REQUEST_URI']">;weblint" (the new Zope syntax is <dtml-XXX, but you can use <!--#var XXX--> if you want. But that doesn't work as REQUEST_URI gives a KeyError. This is weird because other REQUEST variables seem to work. Any deep voodoo Zopistas know why? <dtml-in "REQUEST.items()"> <dtml-var sequence-key> : <dtml-var sequence-item> <br> </dtml-in> Hint: To see all the REQUEST variables tack on /REQUEST to any URL you have (only works with Zope < 2.1.4) or put this in a dtml document <dtml-var REQUEST> To just get the environment variables; <dtml-in "REQUEST.environ.items()"> <dtml-var sequence-key> : <dtml-var sequence-item> <br> </dtml-in> So your code should work if you do this; href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 /<dtml-var "REQUEST.environ['REQUEST_URI']">;weblint" (If this seems long winded, it's because I'm writing this as I figure it out! :) Hint: Remember that anything inside "..." is a Python expression and Python, *not* Zope syntax applies.
I found this snippet of code for an echo and set, but my attempts at modifying it to work for this have failed.
<!--#call "REQUEST.set('varName', 'varValue')"--> <!--#var varName-->
That should work fine. hth Tone. ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project http://nle.ncl.ac.uk/ The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
Thanks for the quick reply...I tried the helpful suggestions, but can't seem to get this to work.
put this in a dtml document <dtml-var REQUEST>
When I do this, I get the list of variables...however, REQUEST_URI is not in the list (the only REQUEST item in the list is REQUST_METHOD). Is it supposed to be in the list? Is this why I am having trouble? How do I get it in the list?
To just get the environment variables; <dtml-in "REQUEST.environ.items()"> <dtml-var sequence-key> : <dtml-var sequence-item> <br> </dtml-in>
Same thing happens here...no REQUEST_URI...
So your code should work if you do this; href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 /<dtml-var "REQUEST.environ['REQUEST_URI']">;weblint"
Nope, doesn't work...hmmm...maybe I am not doing this right....I am so new to Zope....I tried doing a search on REQUEST_URI and dtml, but get less than 5 sites on most search engines, so don't know where else to find info...yikes! :-) Help, Jessica
_______________________________________________ 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 )
On Fri, 17 Mar 2000, jessica lee tishmack wrote:
Thanks for the quick reply...I tried the helpful suggestions, but can't seem to get this to work.
put this in a dtml document <dtml-var REQUEST>
When I do this, I get the list of variables...however, REQUEST_URI is not in the list (the only REQUEST item in the list is REQUST_METHOD). Is it supposed to be in the list? Is this why I am having trouble? How do I get it in the list?
No, it is not supposed to be in the list. Zope is not SSI, nor does it try to be SSI compatable. Zope does have analogous variables, though. For example, when I navigate to http://my.server.com/jeff/dumpRequest, I get: URL0 = http://my.server.com/jeff/dumpRequest URL1 = http://my.server.com/jeff URL2 = http://my.server.com BASE0 = http://my.server.com BASE1 = http://my.server.com BASE2 = http://my.server.com/jeff BASE3 = http://my.server.com/jeff/dumpRequest PATH_INFO = /jeff/dumpRequest PATH_TRANSLATED = /jeff/dumpRequest Since I haven't done much with SSI in the past, I don't know which one is similiar to REQUEST_URI. If I had to guess, I would say PATH_INFO is the one you are looking for. [snip]
So your code should work if you do this; href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80 /<dtml-var "REQUEST.environ['REQUEST_URI']">;weblint"
Nope, doesn't work...hmmm...maybe I am not doing this right....I am so new to Zope....I tried doing a search on REQUEST_URI and dtml, but get less than 5 sites on most search engines, so don't know where else to find info...yikes! :-)
Try this: <A href="http://validator.w3.org/check?uri=http://dnrdb.cbi.tamucc.edu:80&dtml-PATH_INFO;;weblint">Link Text</A> or, <A href="http://validator.w3.org/check?uri=&dtml-URL0;;weblint">Link Text</A> Obviously, the second is preferred, since it is both more clear and requires less maintenance (the URL is not hardcoded, so if your server changes from dnrdb.cbi.tamucc.edu to newserver.cbi.tamucc.edu, the code would not require change.)
Help,
Hope this helps.
Jessica
--Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
PATH_INFO = /jeff/dumpRequest PATH_TRANSLATED = /jeff/dumpRequest
Since I haven't done much with SSI in the past, I don't know which one is similiar to REQUEST_URI. If I had to guess, I would say PATH_INFO is the one you are looking for.
--- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
PATH_INFO worked! Thank you!!!! And thanks for the mini tutorial...that helped a lot....and to Dr. Tony, thanks for showing me how to see all the environment variables with dtml...I just love this mailing list! You all are so helpful. :-) Jessica
jessica lee tishmack wrote:
Thanks for the quick reply...I tried the helpful suggestions, but can't seem to get this to work.
put this in a dtml document <dtml-var REQUEST>
When I do this, I get the list of variables...however, REQUEST_URI is not in the list
Values like this that you are looking for come from the front end web server. Most web servers pass a number of these variables into the environment of a program that they are executing (in this case, Zope). The specification of what variables gets passed and how is called Common Gateway Interface (CGI). REQUEST_URI is not part of the CGI/1.1 (the most recent) spec. I suspect you are used to programming in some sort of SSI environment where REQUEST_URI exists as a convienience for programmers. I do believe I recall REQUEST_URI being a variable in Apache. This convienience does not exist for Zope because it is not a standard CGI variable and Apache does not pass it to Zope or any other CGI program. There is, in fact, probably some other standard variable that does the exact same thing as REQUEST_URI. The list of standard variable can be found at: http://hoohoo.ncsa.uiuc.edu/cgi/env.html -Michel
participants (4)
-
Jeff K. Hoffman -
jessica lee tishmack -
Michel Pelletier -
Tony McDonald