Jump to content

Hiding a container folder inside Breadcrumbs nav?


PhotoWebMax
 Share

Recommended Posts

I have a new site with a hardwired topnav (uses a jQuery powered nav-sprite image) and a PW powered dynamic sideBar nav system.

I am also using the basic Breadcrumbs system:

<div class='breadcrumbs'><!-- breadcrumbs -->
       <?php 
       // breadcrumbs are the current page's parents
		foreach($page->parents() as $item) {
		 echo "<span><a href='$item->url'>$item->title</a></span> "; 
		}
		// optionally output the current page as the last item
		echo "<span>$page->title</span> "; 
		?>
		</div><!-- end breadcrumbs -->

This all works fine for the most part. I have a hidden container folder to contain all the generated sideBar links. 

 What I don't like is that the hidden folder shows up in the Breadcrumbs navigation like so:

Home > SideBarPages > Blog > Link One

So, is there a way I can prevent the SideBarPages link from showing here?

Thanks!

Link to comment
Share on other sites


div class='breadcrumbs'><!-- breadcrumbs -->

<?php

// breadcrumbs are the current page's parents

foreach($page->parents() as $item) {

//skip SideBarPages using id of the page.

//You can also use $item->id=='1234' $item->title=='titleOfSideBarPages, $item->name, etc

//using the ID, though less readable, is more foolproof

if ($item=='1234') continue;

echo "<span><a href='$item->url'>$item->title</a></span> ";

}

// optionally output the current page as the last item

echo "<span>$page->title</span> ";

?>

</div><!-- end breadcrumbs -->

  • Like 5
Link to comment
Share on other sites

  • 4 years later...

Hi there,

five years later… ?

Is it possible to hide a page in a breadcrumb depending on the template?

Something like this (it's not working):

<?php
      foreach($page->parents() as $item) {
        if ($item->('template=myTemplate')) continue;
        echo "<li><a href='$item->url'>$item->title</a></li> ";
      }
      echo "<li>$page->title</li>";

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...