Skip to content

Instantly share code, notes, and snippets.

@formmailer
Created November 15, 2011 08:44
Show Gist options
  • Save formmailer/1366480 to your computer and use it in GitHub Desktop.
Save formmailer/1366480 to your computer and use it in GitHub Desktop.
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.
<?
/*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