Skip to content

Instantly share code, notes, and snippets.

@mr-fan
Forked from formmailer/breadcrumbs.php
Created June 15, 2014 22:37
Show Gist options
  • Save mr-fan/9bf5483cbc595e21fc13 to your computer and use it in GitHub Desktop.
Save mr-fan/9bf5483cbc595e21fc13 to your computer and use it in GitHub Desktop.
<?
/*Breadcrumbs
=====================
This is a general way to create breadcrumbs for ProcessWire pages.
It retreives in an array all the parents and will walk through the array to display the title and URL of the parents.
The last echo returns the title of the current page, without a link.
=====================*/
?>
<div id="breadcrumbs">
<ul>
<?php
foreach($page->parents as $parent) {
echo "<li><a href='{$parent->url}'>{$parent->title}</a> &raquo;</li>";
}
echo "<li>{$page->title}</li>";
?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment