[Zope] breadcrumbs in a python script

Ben.Peter@t-online.de Ben.Peter@t-online.de
Sun, 15 Apr 2001 03:15:32 +0200 (CEST)


Hi,

I did, yes. It's really ugly, clumsy, bad style and probably faulty, but
maybe it's a start:

#Python Script 'crumbs'
results=[]
sub = context
while sub != container:
    results.append( ['/' + sub.absolute_url(1), sub.title ])
    sub = sub.restrictedTraverse( '..' )
results.append( ['/', 'Home'] )
results.reverse()
results.pop()	
return results


You can then use 
<dtml-in crumbs>
<a href="<dtml-var expr="_.getitem('sequence-item')[0]">">
<dtml-var expr="_.getitem('sequence-item')[1]"></a>
</dtml-in>

to display the links. 

I'd be glad to see suggestions on how to better the approach.

Cheers,
Ben

-- 
Ben Peter - Feldstrasse 8 - 35091 Coelbe
      Ben.Peter@t-online.de
      ph: (+49) 6421 983520