[Zope-CMF] Re: Re-working Breadcrumbs

Chris Withers chrisw@nipltd.com
Tue, 28 Aug 2001 00:27:11 +0100


And this is why I think ZPT can be just as abused as DTML :-(

Keep your logic in PythonScripts rather than torturing your designers by
having to wade through pain like that.

If ZPT doesn't support that, then it's broken...

Not that this a sore point for me or anything ;-)

Chris

----- Original Message -----
From: "Thomas Olsen" <tol@tanghus.dk>
To: "Chris Withers" <chrisw@nipltd.com>; <davelehman@loewen.com>
Cc: "zope-cmf" <zope-cmf@zope.org>
Sent: Monday, August 27, 2001 9:06 PM
Subject: Re: [Zope-CMF] Re: Re-working Breadcrumbs


> 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
>
>