Maybe a stupid newbie question - forcing an in loop to the Root Folder's context.
I've created a method in the root folder that basically does some dtml-in looping over objectValues. It works fine when included (via var) in other methods and docs in the root window. The problem is that I want it to be aquired by sub-folders, but want it to still loop through the root folder's contents. In other words, I should be able to call my method anywhere in sub-folders or items deep in the site, and still get a list of objects in the root folder. Can I do this in DTML? Does it require python? Does it need to be an external script? Can someone point me in a direction? - Jim dongle@home.com
ahhh, the magic of acquisition. You need to restrict the lookup to the root. There are a couple ways to do it. Use a <dtml-with rootFolder> to alter the namespace to look-up where you want it to. Check out the online how-to for dtml-with. other options include restrcting traversal using PARENTS. -Trevor
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jim Nicholson Sent: Saturday, November 17, 2001 12:47 AM To: zope@zope.org Subject: [Zope] Maybe a stupid newbie question - forcing an in loop to the Root Folder's context.
I've created a method in the root folder that basically does some dtml-in looping over objectValues. It works fine when included (via var) in other methods and docs in the root window.
The problem is that I want it to be aquired by sub-folders, but want it to still loop through the root folder's contents.
In other words, I should be able to call my method anywhere in sub-folders or items deep in the site, and still get a list of objects in the root folder.
Can I do this in DTML? Does it require python? Does it need to be an external script? Can someone point me in a direction?
- Jim dongle@home.com
_______________________________________________ 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 )
Jim Nicholson wrote:
I've created a method in the root folder that basically does some dtml-in looping over objectValues. It works fine when included (via var) in other methods and docs in the root window.
The problem is that I want it to be aquired by sub-folders, but want it to still loop through the root folder's contents.
In other words, I should be able to call my method anywhere in sub-folders or items deep in the site, and still get a list of objects in the root folder.
Can I do this in DTML? Does it require python? Does it need to be an external script? Can someone point me in a direction?
Hi, Jim Probably best to create the list of objectValues in a python script in the root. Something like: return container.objectValues('Folder') which, since root is the container, would always return the Folders in the root folder. If you name it something like 'nav_list', then you can replace the <dtml-in "objectValues()"> in the method you are currently using with <dtml-in nav_list> hth, -- Jim Washington
On Saturday 17 November 2001 12:47 am, Jim Nicholson allegedly wrote:
I've created a method in the root folder that basically does some dtml-in looping over objectValues. It works fine when included (via var) in other methods and docs in the root window.
The problem is that I want it to be aquired by sub-folders, but want it to still loop through the root folder's contents.
In other words, I should be able to call my method anywhere in sub-folders or items deep in the site, and still get a list of objects in the root folder.
Can I do this in DTML? Does it require python? Does it need to be an external script? Can someone point me in a direction?
- Jim dongle@home.com
Use a DTML Document in the Root folder. "Containment before context" /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
participants (4)
-
Casey Duncan -
Jim Nicholson -
Jim Washington -
Trevor Toenjes