[Zope] Alternative to "PARENTS[0]"?
Brian Lloyd
Brian@digicool.com
Fri, 6 Aug 1999 09:40:10 -0400
> Howdi,
> I use a "link_table" dtml document that has the
> following snippet:
> ...
> <!--#with expr="PARENTS[0]"-->
> <table <!--#var link_table_properties-->>
> <!--#in expr="objectValues(spec='Folder')" sort=title-->
> ...
>
> I call this document from all over my site structure to
> create nice standard
> tables of links, based on sub folders with common properties.
> Trouble is I can't use it to render tables from folders other
> than the current.
> The PARENTS list always starts with the parent of the
> initially active document,
> eg index_html's parent folder.
>
> Okay the question is, I think: what is the best way to
> retrieve a list of
> objects under a folder that is not the "current" folder?
Basically, you just need to call "objectValues" on the Folder
you are interested in. As long as the Folder is _above_ you
in the heirarchy, you can acquire it. If it is below you, then
just refer to it as if it were any other subobject. For example,
say your site has a folder setup like:
folder1
folder2
folder3
folder4
folder5
folder6
Now, lets say the actual dtml is actually called with the url:
/folder1/folder2/folder3/folder4/index_html
So to create a table based on folder2, we can 'acquire' folder2:
<!--#in expr="folder1.folder2.objectValues(spec='Folder')"
sort=title-->
or if we want to list folder6, we just start at the current level:
<!--#in expr="folder5.folder6.objectValues(spec='Folder')"
sort=title-->
Hope this helps!
Brian Lloyd brian@digicool.com
Software Engineer 540.371.6909
Digital Creations http://www.digicool.com