I was trying to limit the breadcrumbs output so as not to show first level menu items and after looking a little deeper into function show_breadcrumbs() and playing with the current parameters I didn't think this was possible?
For my example I copied & renamed the function show_breadcrumbs() into my templates index.php as per below and added a new parameter to the beginning of the sequence of parameters in the function.
I imagine this conditional statement could be coded better/differently as it may not be aware of conditions for advanced situations?
if (count($bca)==1 && $noRootLevel==1)
Regards,
Matt
<div class="breadcrumb">
<?php
function show_breadcrumbsSpecial($noRootLevel=0,$sep=' > ',$tier=1,$links=true,$depth=-1) {
global $wb;
$page_id=$wb->page_id;
if ($page_id!=0)
{
global $database;
$bca=$wb->page_trail;
if (count($bca)==1 && $noRootLevel==1) {
echo ' ';
} else {
echo '<b>You are here:</b> ';
$counter=0;
foreach ($bca as $temp)
{
if ($counter>=($tier-1) AND ($depth<0 OR $tier+$depth>$counter))
{
if ($counter>=$tier) echo $sep;
$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
$page=$query_menu->fetchRow();
if ($links==true AND $temp!=$page_id)
echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
else
echo $page['menu_title'];
}
$counter++;
}
}
}
}
show_breadcrumbsSpecial(1);?>
</div>
Hello,
did you try it with a simply show_menu2 call? Look at the dokumentation of show_menu2, I'm pretty shure you can reach this with only one single line in your template, wich is much more better as to add whole functions in the template.
Matthias
Hi Matthias,
Quote
did you try it with a simply show_menu2 call? Look at the dokumentation of show_menu2, I'm pretty shure you can reach this with only one single line in your template, wich is much more better as to add whole functions in the template.
Matthias
I did look at the docs for 'show_menu2', there was 2 examples of breadcrumb but neither could turn off the breadcrumb output when viewing a first level menu item. I also read in another forum about another module for breadcrumbs but the link was dead;
So i thought this modified function was okay, perhaps like you say not the best solution adding a function into template but i figure whether this function is called or another similar function called its still processing time and well, this little function works. :-)
cheers,
Matt
2-3days into website baker, finished 1 website, some php coding, css flyouts achieved and loving it...