(Newbie) Tree based sitemap using Zope book example
Hi All, I am trying to develop a website that has a tree based site map on each page. I have used an example in the Zope book where an objects appearence in the sitemap depends on setting a property SiteMap and uses a small Python script to test whether the property has been set. The calling dtml method uses the following code:- <dtml-tree branches="PublicObjects" skip_unauthorized="1"> <a href="&dtml-absolute_url;"><dtml-var title_or_id></a> </dtml-tree> which in turn calls the following script. """ Returns sub folders and DTML documents that have a true 'siteMap' property. """ results=[] for object in context.objectValues(['Folder', 'DTML Document']): if object.hasProperty('siteMap') and object.siteMap: results.append(object) return results This works fine in that context.objectValues(['Folder', 'DTML Document']) displays a tree based site map but of course creates it relative to the current folder object. For the life of me I can't work out how to change the script or the call so that the tree that is displayed is always the root tree or rooted in any specified arbitary folder. Is it possible to specify a context rather than the current one? - I presume it is I just don't understand Zope (or Python...) enough to work out how to do it... Zope is a fantastic product but my head is still spinning from the learning curve... All help appreciated. Cheers Adrian ======================================================================= Adrian Blockley (adrian.blockley@environ.wa.gov.au) Western Australian Department of Environment Water and Catchment Protection Address: Department of Environment Water and Catchment Protection 141 St Georges Tce Perth WA 6000 Ph: +61 8 9222 7165 Fax: +61 8 9321 5184 ======================================================================= Disclaimer: This e-mail is confidential to the addressee and is the view of the writer, not necessarily that of the Department of Environmental Protection, which accepts no responsibility for the contents. If you are not the addressee, please notify the Department by return e-mail and delete the message from your system. You must not disclose or use this information in any way. No warranty is made that this material is free from computer viruses.
On Mon, 2001-10-22 at 18:55, Adrian Blockley wrote:
This works fine in that context.objectValues(['Folder', 'DTML Document']) displays a tree based site map but of course creates it relative to the current folder object. For the life of me I can't work out how to change the script or the call so that the tree that is displayed is always the root tree or rooted in any specified arbitary folder. Is it possible to specify a context rather than the current one? - I presume it is I just don't understand Zope (or Python...) enough to work out how to do it...
Dang that takes me back... I first asked this back in February '99... Hey, I guess this makes me an official Zope curmudgeon! Anyway, here is the version from the mail archives: http://lists.zope.org/pipermail/zope/1999-February/002164.html The rest of that thread might be interesting to you too... And here is Amos' improved version from Google's cache: http://www.google.com/search?q=cache:zbv3CYIDr_c:classic.zope.org:8080/Docum... I'm not sure why that Howto disappeared from the current site.
Zope is a fantastic product but my head is still spinning from the learning curve...
Yeah. Don't worry things will settle down in a bit, and then you'll get a reply from Jim Fulton, and you'll realize that you didn't actually understand what you thought you understood at all... And so it begins... Michael Bernstein.
participants (2)
-
Adrian Blockley -
Michael R. Bernstein