WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Code Snippet: breadcrumb showing or not showing 1st level/or single menu items
  • Print
Pages: [1]   Go Down

Author Topic: Code Snippet: breadcrumb showing or not showing 1st level/or single menu items  (Read 6833 times)

swagmani

  • Guest
Code Snippet: breadcrumb showing or not showing 1st level/or single menu items
« on: February 12, 2008, 02:26:43 AM »
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


Code: [Select]
<div class="breadcrumb">
    <?php
            
function show_breadcrumbsSpecial($noRootLevel=0,$sep=&#39; > &#39;,$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 &
#39;&nbsp;&#39;;
                    
} else {
                    echo &
#39;<b>You are here:</b>&nbsp;&#39;;
                        
$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 &
#39;<a href="&#39;.page_link($page[&#39;link&#39;]).&#39;">&#39;.$page[&#39;menu_title&#39;].&#39;</a>&#39;;
                                
else
                                    echo 
$page[&#39;menu_title&#39;];
                            
}
                            
$counter++;
                            }
                    }
                }
            }
        
show_breadcrumbsSpecial(1);?>
&nbsp;
</div>
« Last Edit: February 12, 2008, 07:40:39 AM by swagmani »
Logged

Offline ruebenwurzel

  • Betatester
  • **
  • Posts: 8544
  • Gender: Male
  • Keep on Rockin
    • Familie Gallas Online
Re: Code Snippet: breadcrumb showing or not showing 1st level/or single menu ite
« Reply #1 on: February 12, 2008, 06:57:21 AM »
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
Logged

swagmani

  • Guest
Re: Code Snippet: breadcrumb showing or not showing 1st level/or single menu ite
« Reply #2 on: February 12, 2008, 07:24:34 AM »
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...
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Code Snippet: breadcrumb showing or not showing 1st level/or single menu items
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2