Quote from: bullrat at Sep 14, 2006, 06:42 PM
The Breadcrumbs snippet is great. I’m incorporating it on every page but homepage like this...
Home >> Category >> Subcategory >> Content
I would prefer for Breadcrumbs to display like this instead...
Home >> Category >> Subcategory >>
Note that I wish the last » (>>) to continue to display, just not the final child when you reach that page. I saw the span named ’.B_lastCrumb’ that surrounds the last crumb but this is a dynamic last crumb and not necessarily the real last child. I couldn’t find an UltimateChild-type parameter to turn off. Is this possible? If you reply, please remember, I’m a mortal, not a developer by trade. Thank you!
Okay, if you’re clueless like me and need the functionality I requested help on above -- here’s one possible method. I hate to hack a snippet as I don’t know what I’m doing, so use this at your own risk. The reason I needed the ultimate child to disappear in the BreadCrumb is so that I wouldn’t have redundant wording (once in the BreadCrumb and then again starting the page content).
I replaced the code that
doze mentions above using "<=3" instead of ">1" to ensure that all levels above my final content used the BreadCrumb as usual. You would need to set this number to reflect your own levels.
if (count($ptarr)<=3) {
return '<span class="B_crumbBox">'. join($ptarr, " $crumbSeparator ").'</span>';
}
Then, below that, I forced the BreadCrumb output I wanted manually by backing up the breadcrumb trail. Again, I don’t know what I’m doing but this seems to work for me and perhaps this post will spur a coder to post the correctly coded solution. This is a great snippet but it would be even better with an UltimateChild parameter that could be toggled on or off. I hope this helps someone. Thanks!
if (count($ptarr)>3) {
return '<span class="B_crumbBox">'.$ptarr[count($ptarr)-4].'</span>' . " $crumbSeparator " .
'<span class="B_crumbBox">'.$ptarr[count($ptarr)-3].'</span>' . " $crumbSeparator " .
'<span class="B_crumbBox">'.$ptarr[count($ptarr)-2].'</span>' . " $crumbSeparator " ;
}