[Zope] breadcrumbs ques

Chris Withers chrisw@nipltd.com
Wed, 18 Sep 2002 11:08:28 +0100


AM wrote:
> 
> <dtml-in PARENTS reverse>
> <dtml-with PARENTS>
>  <dtml-if sequence-start>
>   <a href="/nbs_online" class='cyan_link'>Home</a>
>  <dtml-else>
>   <dtml-if sequence-end><dtml-else>&rsaquo;&rsaquo;
>    <a href="<dtml-var absolute_url>" class='cyan_link'><dtml-var 
> title_or_id></a>
>   </dtml-if>
>  </dtml-if>
> </dtml-with>
> </dtml-in>

Using PARENTS for breadrumbs is bogus.

I would do have a python script called 'breadcrumbs':

result = []
url = context.getPhysicalRoot().absolute_url()
path = context.getPhysicalPath()
for id in path:
   url = url + '/' + id
   result.append({'id':id,'url':url}
return result[1:] # adjust as appropriate to get your site root

Then just do the following in your method:

<dtml-in breadcrumbs mapping>
<a href="&dtml-url;">&dtml-id;</a>
<dtml-unless sequence-end>
&rsaquo;&rsaquo;
</dtml-unless>
</dtml-in>

cheers,

Chris