Hello all, I am utterly confused: The following piece of dtml in standard_html_header <dtml-in "objectItems()"> <a href="<dtml-var absolute_url>"><dtml-var title></a> <dtml-unless sequence-end><br> </dtml-unless> <dtml-else>No items. </dtml-in> will yield a complete list of objects in the current container if there is a DTML Method 'index_html' available. If that is not the case, it will print 'No items.', even if there is a DTML Document index_html and any number of other Items, like folders. Is this intentional or (which I believe it'll turn out to be) am I blind again? Thanks for your help, Ben -- Ben Peter - Feldstrasse 8 - 35091 Coelbe Ben.Peter@t-online.de ph: (+49) 6421 983520
On Monday 16 April 2001 11:21, Ben.Peter@t-online.de wrote:
Hello all,
I am utterly confused:
The following piece of dtml in standard_html_header
<dtml-in "objectItems()"> <a href="<dtml-var absolute_url>"><dtml-var title></a> <dtml-unless sequence-end><br> </dtml-unless> <dtml-else>No items. </dtml-in>
will yield a complete list of objects in the current container if there is a DTML Method 'index_html' available. If that is not the case, it will print 'No items.', even if there is a DTML Document index_html and any number of other Items, like folders.
it may be the fact that DTML Document has its own namespace. i may be wrong though
Ben.Peter@t-online.de wrote:
Hello all,
I am utterly confused:
The following piece of dtml in standard_html_header
<dtml-in "objectItems()"> <a href="<dtml-var absolute_url>"><dtml-var title></a> <dtml-unless sequence-end><br> </dtml-unless> <dtml-else>No items. </dtml-in>
will yield a complete list of objects in the current container if there is a DTML Method 'index_html' available. If that is not the case, it will print 'No items.', even if there is a DTML Document index_html and any number of other Items, like folders.
Is this intentional or (which I believe it'll turn out to be) am I blind again?
Thanks for your help, Ben
-- Ben Peter - Feldstrasse 8 - 35091 Coelbe Ben.Peter@t-online.de ph: (+49) 6421 983520
DTML Documents subclass from SimpleItem.Item which purposely masks objectItems, et al because they are not containers. To get your code to work properly, you must first check to see whether the current context is a folder or not (which it will be if the url points to a DTML Method). You can do this by checking for the attribute "isPrincipiaFolderish" which all folderish objects will have set to true: <dtml-if name="isPrincipiaFolderish"> <dtml-call expr="REQUEST.set(folder, this())"> <dtml-else> <dtml-call expr="REQUEST.set(folder, aq_parent)"> </dtml-if> <dtml-in expr="folder.objectItems()"> ... </dtml-in> hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
On Mon, 16 Apr 2001, Casey Duncan wrote:
DTML Documents subclass from SimpleItem.Item which purposely masks objectItems, et al because they are not containers. To get your code to work properly, you must first check to see whether the current context is a folder or not (which it will be if the url points to a DTML Method). [...]
Thanks so much for the answer, that makes it clear. I didn't realize that 'this' was not the folder but the Document in it, while with a method, I would work with the folder. Cheers, Ben -- Ben Peter - Feldstrasse 8 - 35091 Coelbe Ben.Peter@t-online.de ph: (+49) 6421 983520
participants (3)
-
bak -
Ben.Peter@t-online.de -
Casey Duncan