DMTL-document as parameter to DMTL
Hi I want to be able to get the name of a DTML-document as a parameter to a DTML-method, so that I can display it the way I want. In other words, if I want to see foo.txt this way, I would use http://.....display?foo.txt How do I get the value of the parameter if display is a DTML-method? Any ideas? -- / hans - http://go.to/tusenfrydveien32 / http://www.spacetec.no/~hans/dfood.htm /--------------------------------------------- / HANS = High Availability No Superman
WHen you do something of the form.http://url?foo.txt ( well thats not the right way but..) foo.txt comes in as a request parameter called QUERY_STRING. Actually anything after the '?'. The right way would be http://url?file=foo.txt then you could access foo.txt as REQUEST.file or REQUEST.get('file'). If you do it this way you can alos send in other stuff via the URL. However if you do have to use the URL you mention use REQUEST.QUERY_STRING to get it. hth AM Hans Sandsdalen wrote:
Hi
I want to be able to get the name of a DTML-document as a parameter to a DTML-method, so that I can display it the way I want.
In other words, if I want to see foo.txt this way, I would use
How do I get the value of the parameter if display is a DTML-method?
Any ideas?
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Hi I use this code: <dtml-var standard_html_header> <dtml-var expr="REQUEST.file"><br> <dtml-with expr="REQUEST.file"> Title: <dtml-var title><br> Id : <dtml-var id><br> </dtml-with> <dtml-var standard_html_footer> and that way I am able to get the file name. But there are some errors in my code, because the output is not what I expexted: entry_1037698423 Title: Entry_1037698423 Id : news The entry_1037698423 file has a title, and the id should be the same as <dtml-var expr="REQUEST.file">. I must admit that I don't know much DTML.... On Thu, 2003-01-16 at 17:12, AM wrote:
WHen you do something of the form.http://url?foo.txt ( well thats not the right way but..) foo.txt comes in as a request parameter called QUERY_STRING. Actually anything after the '?'.
The right way would be http://url?file=foo.txt
then you could access foo.txt as REQUEST.file or REQUEST.get('file'). If you do it this way you can alos send in other stuff via the URL.
However if you do have to use the URL you mention use REQUEST.QUERY_STRING to get it.
hth AM
Hans Sandsdalen wrote:
Hi
I want to be able to get the name of a DTML-document as a parameter to a DTML-method, so that I can display it the way I want.
In other words, if I want to see foo.txt this way, I would use
How do I get the value of the parameter if display is a DTML-method?
Any ideas?
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
-- / hans - http://go.to/tusenfrydveien32 / http://www.spacetec.no/~hans/dfood.htm /--------------------------------------------- / HANS = High Availability No Superman
FFFHans Sandsdalen wrote at 2003-1-17 09:58 +0100:
... <dtml-var expr="REQUEST.file"><br>
<dtml-with expr="REQUEST.file"> Title: <dtml-var title><br> Id : <dtml-var id><br> ... and that way I am able to get the file name. But there are some errors in my code, because the output is not what I expexted:
entry_1037698423 Title: Entry_1037698423 Id : news
The entry_1037698423 file has a title, and the id should be the same as <dtml-var expr="REQUEST.file">. I expect, "REQUEST.file" is a "ZPublisher.HTTPRequest.FileUpload" instance (a file you have uploaded)?
In this case, it has neither an id nor a title. You get the one from the enclosing context. Dieter
Hi This is my problem: I try to make a application like the guest book (se http://www.zope.org/Documentation/Books/ZopeBook/current/SimpleExamples.stx) and I would like to be able to display only one entry at a time. I use this code to list alle entries (index_html) ----------------------------------------------------------------------- <dtml-var standard_html_header> <h2><dtml-var document_title></h2> <p> <table> <tr> <th>Tidspunkt</th> <th>Overskrift</th> <th>Forfatter</th> </tr> <dtml-in expr="objectValues('DTML Document')" sort="bobobase_modification_time" reverse> <tr> <td><b><dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M"></b></td> <td><a href="ShowNews?file=<dtml-var id>"><dtml-var title></a></td> <td>(<dtml-var brukernavn html_quote null="">)</td> </tr> </dtml-in> </table> <dtml-var standard_html_footer> ----------------------------------------------------------------------- The ShowNews DTML-Method (so far just a test): ----------------------------------------------------------------------- <dtml-var standard_html_header> <dtml-var expr="REQUEST.file"><br> <dtml-with expr="REQUEST.file"> Title: <dtml-var title><br> Id : <dtml-var id><br> </dtml-with> <dtml-var standard_html_footer> ----------------------------------------------------------------------- There is one DTML-Document named "entry_1037698423", with title, and another property value named brukernavn (with a value of course). If i display index_html, and select the entry with id entry_1037698423 the result is this: entry_1037698423 Title: Entry_1037698423 Id : news ("news" is the name of the directory). How do I get the title and other properties, as well as the content of the DTML-Document? On Fri, 2003-01-17 at 21:51, Dieter Maurer wrote:
FFFHans Sandsdalen wrote at 2003-1-17 09:58 +0100:
... <dtml-var expr="REQUEST.file"><br>
<dtml-with expr="REQUEST.file"> Title: <dtml-var title><br> Id : <dtml-var id><br> ... and that way I am able to get the file name. But there are some errors in my code, because the output is not what I expexted:
entry_1037698423 Title: Entry_1037698423 Id : news
The entry_1037698423 file has a title, and the id should be the same as <dtml-var expr="REQUEST.file">. I expect, "REQUEST.file" is a "ZPublisher.HTTPRequest.FileUpload" instance (a file you have uploaded)?
In this case, it has neither an id nor a title. You get the one from the enclosing context.
Dieter
-- / hans - http://go.to/tusenfrydveien32 / http://www.spacetec.no/~hans/dfood.htm /--------------------------------------------- / HANS = High Availability No Superman
Hans Sandsdalen wrote at 2003-1-20 13:22 +0100:
This is my problem: .... seems to be:
You have an id or and object path and need to get access to the object itself, right? In this case, you need either "computed object access" (this is the case for you) or "computed attribute access". You use "_.getitem" for "computed object access" and "_.getattr" for computed attribute access. For more information, see the "Name lookup" section in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Dieter
Dieter It worked. Thanks! On Tue, 2003-01-21 at 06:44, Dieter Maurer wrote:
Hans Sandsdalen wrote at 2003-1-20 13:22 +0100:
This is my problem: .... seems to be:
You have an id or and object path and need to get access to the object itself, right?
In this case, you need either "computed object access" (this is the case for you) or "computed attribute access".
You use "_.getitem" for "computed object access" and "_.getattr" for computed attribute access.
For more information, see the "Name lookup" section in
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
Dieter
_______________________________________________ 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 )
-- / hans - http://go.to/tusenfrydveien32 / http://www.spacetec.no/~hans/dfood.htm /--------------------------------------------- / HANS = High Availability No Superman
participants (6)
-
AM -
Dieter Maurer -
Hans Sandsdalen -
Hans Sandsdalen -
Hans Sandsdalen -
Hans Sandsdalen