That sounds like a good technique. I've modified Plugin::Breadcrumb to work properly and put it in my source tree, but I think I like your technique better.
Kyle http://www.kylehall.info Mill Run Technology Solutions ( http://millruntech.com ) Crawford County Federated Library System ( http://www.ccfls.org ) Meadville Public Library ( http://www.meadvillelibrary.org ) On Wed, Mar 23, 2011 at 10:27 AM, will trillich <[email protected]> wrote: > We tried some of the breadcrumb libraries too, but couldn't wrestle them > into our paradigm, either. There are underlying assumptions about your app > or url structure where it tries to divine patterns on its own that often > just don't jibe with what you've got set up. > What we do instead is, we call a function to add another link in our > breadcrumb chain, so it's deliberate and we're completely in control: > $c->add_breadcrumb( "/some/$url_component/here", 'Text for link here' ); > throughout our code, and then in the template: > <ul id="breadcrumbs"> > <li>You are here:</li> > [% FOREACH crumb IN breadcrumbs -%] > <li>[% > IF loop.last %]<span title="You are here">[% crumb.label %]</span>[% > ELSE %]<a href="[% c.uri_for(crumb.path).path %]">[% crumb.label > %]</a>[% > END > %]</li> > [% END -%] > </ul> > And here's MyApp::add_breadcrumb en toto-- > sub add_breadcrumb { > my ( $c, $path, $label ) = @_; > my $bc = $c->stash->{breadcrumbs} ||= []; > push @$bc, +{ > path => $path, > label=> $label, > }; > } > On Wed, Mar 23, 2011 at 8:40 AM, Kyle Hall <[email protected]> wrote: >> >> Hello All, >> >> I'm working on adding breadcrumbs to my catalyst app and I've run into >> something unexpected. >> >> I'm using Catalyst::Plugin::Breadcrumbs. Let's assume I have a >> controller Foo. If I just go to /foo ( the index ), the plugin assumes >> that the action will be 'index', but the action is actually just >> 'foo'. >> >> Because of this, my breadcrumbs show as Foo/Foo instead of Foo/Index ( >> or just Foo if hide_index is true ). >> >> Is this expected behaviour? Has the behaviour changed since >> Plugin::Breadcrumbs was written? I've been able to modify the code for >> the plugin to compensate, but was hoping someone could shed some light >> on this subject. >> >> Thanks, >> Kyle >> >> http://www.kylehall.info >> Mill Run Technology Solutions ( http://millruntech.com ) >> Crawford County Federated Library System ( http://www.ccfls.org ) >> Meadville Public Library ( http://www.meadvillelibrary.org ) >> >> _______________________________________________ >> List: [email protected] >> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst >> Searchable archive: >> http://www.mail-archive.com/[email protected]/ >> Dev site: http://dev.catalyst.perl.org/ > > > > -- > 11 cheers for binary! > _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
