How to refer an object in a sub folder?
How to refer an object in a sub folder? I have a folder 'java' under a folder 'tech'. I have a template 'index' in 'tech'. How do I refer to 'index' in the folder 'java' from an object in 'tech'? <dtml-var java/index> ??? Thanks in advance, Samy Rengasamy.
Hello Samy.
How do I refer to 'index' in the folder 'java' from an object in 'tech'?
<dtml-var java/index> ??? Try this: <dtml-var "java.index">
If you rename your file to "index_html" you can even do this: <dtml-var java> Please keep in mind, that you are dealing with objects in zope, _not_ files and folders. (Even if the management screens make you think this) If your browser looks for http://my.zopeserver.org/main/sub/sub1/anothersub/index_html this is similar to <dtml-var "main.sub.sub1.anothersub"> or <dtml-var "main.sub.sub1.anothersub.index_html"> Greetings Sven Rudolph P.S. Broken english spoken perfectly
Sven Rudolph writes:
How do I refer to 'index' in the folder 'java' from an object in 'tech'?
<dtml-var java/index> ??? Try this: <dtml-var "java.index"> Almost surely, it will not work (as wanted):
"index" is probably a DTML object. DTML objects usually need to be rendered to be useful as "dtml-var" arguments, something like: <dtml-var expr="_.render(java.index)">
If you rename your file to "index_html" you can even do this: <dtml-var java> Apparently a wide spread misconception!
"index_html" is only appended by ZPublisher, e.g. during URL traversal. "dtml-var" rendering does not do that! Please read <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> for a detailed description. Dieter
Hello Dieter.
Try this: <dtml-var "java.index"> Almost surely, it will not work (as wanted):
"index" is probably a DTML object. DTML objects usually need to be rendered to be useful as "dtml-var" arguments... You are absolutely right. I tested it only with my own products, which have their own "__call__()" or their own "index_html" (in most cases a reference to __call__()).
Greetings Sven Rudolph
Rengasamy, Samy writes:
How to refer an object in a sub folder?
I have a folder 'java' under a folder 'tech'. I have a template 'index' in 'tech'.
How do I refer to 'index' in the folder 'java' from an object in 'tech'?
<dtml-var java/index> ??? This is an FAQ:
* "dtml-with" * attribute access 'expr="java.index(_.None,_)"' (in case "index" is a DTML object) * "restrictedTraverse" Please read the Zope book or <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> to learn more about these options. Dieter
participants (3)
-
Dieter Maurer -
Rengasamy, Samy -
Sven Rudolph