Jump to content

Breadcrumbs


gnome
 Share

Recommended Posts

I am using

$parents = $page->parents;

foreach($parents as $parent)
{
[indent=1]// do llinks[/indent]
}

to show breadcrumb links.

The problem I have is that sometimes the parent page is a section rather than a page with content. For example, I have a section called About Us which contains various pages, but About Us is not a page itself.

I could create an About Us page and have a meta refresh in it to go to the first page of that section, but is there a better way?

Thanks!

Link to comment
Share on other sites

If those pages don't have a template file, you could check for the existence of the file

foreach($parents as $parent)
{
if(file exists) //echo link
}

or you can use the same template for all the section pages

foreach($parents as $parent)
{
if($parent->template != "section") //echo link
}

or create a global field (available in all templates) from type checkbox, and check it on the section pages

foreach($parents as $parent)
{
if($parent->section = 0) //echo link <-- EDIT: I changed from 1 to 0 here
}
  • Like 2
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...