[Zope-CMF] Re: Re-working Breadcrumbs

Thomas Olsen tol@tanghus.dk
Mon, 27 Aug 2001 22:06:15 +0200


I doubt that this is less expensive - and it doesn't even show the title - 
just a ZPT way of doing it :-)

<span tal:define="
        path python:here.portal_url.getRelativeUrl(here);
        steps python:modules['string'].split(path, '/');
        last python:steps.pop();
        breadcrumbs python:[];
        url here/portal_url">
    <span tal:replace="here/Type">Object</span> at
    <span tal:condition="path" tal:repeat="step steps"><a
    href=""
    tal:define="dummy python:breadcrumbs.append(step); vstep 
python:here.truncID(step, size=15)"
    tal:attributes="href python:'/'+modules['string'].join(breadcrumbs, '/')"
    tal:content="string:/${vstep}">Step</a></span>
    <span tal:replace="string:/${last}">/Last</span>
</span>


On Monday 27 August 2001 20:25, Chris Withers wrote:
> (always CC the list in case someone else can help too)
>
> > I'm sorry to bother you, but thought you might have a minute for a quick
> > question about the "breadcrumbs" script you posted to the Zope-CMF list:
> >
> > I'm trying to extend your script a bit so that the breadcrumb string
> > returned shows the Title of a folder (object) instead of just the id from
> > the URL. I'm not quite sure how to do this...
>
> try this:
>
> object = context.portal_url.getPortalRoot() # not sure of the exact syntax
> here
> for step in steps:
>   object = object[step]
>   url = object.absolute_url()
>   title = object.Title()
>   breadcrumbs.append(pattern % (url,title)
>
> cheers,
>
> Chris
>
> PS: This is quite an expensive method to execute, maybe someone has a
> better one?
>
>
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
> requests

-- 
Regards,
	Thomas Olsen

http://www.tanghus.dk