Jump to main content Jump to doc navigation

What is BreadCrumb?

Breadcrumb is a snippet for MODX Revolution, inspired by the Breadcrumbs snippet.

As the original Breadcrumbs, this snippet will create a breadcrumb navigation (no kidding !!) but also add some new features like template properties or specific resource ID property.

Requirements

  • MODX Revolution 2.0.x or later
  • PHP5 or later

Public Releases

Version Date Author Product
1.4.4-pl October 1, 2019 ------------------- Revolution
1.4.3-pl March 7, 2015 ben_omycode & Jako Revolution
1.4.2-pl August 12, 2014 ben_omycode Revolution
1.4.1-pl August 7, 2014 ben_omycode Revolution
1.4.0-pl August 6, 2014 ben_omycode Revolution
1.3.2-beta1 December 11, 2012 ben_omycode Revolution
1.3.1-pl November 16, 2012 ben_omycode Revolution
1.3.0-pl August 28, 2012 ben_omycode Revolution
1.2.0-pl August 22, 2012 ben_omycode Revolution
1.1.0-pl April 24, 2012 ben_omycode Revolution
1.0.0-pl February 6, 2012 ben_omycode Revolution
1.0.0-beta3 November 19, 2011 ben_omycode Revolution
1.0.0-beta2 November 18, 2011 ben_omycode Revolution

Download

It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here: https://modx.com/extras/package/breadcrumb

Support, Comments, Development and Bug Reporting

Usage

The BreadCrumb snippet can be called using the tag :

[[BreadCrumb]]
Name Description Default Version
from Resource ID from which breadcrumb is created 0 1.1.0-pl
to Resource ID whose breadcrumb is created current resource ID 1.1.0-pl
exclude Comma separated list of resources to exclude from breadcumb 1.4.0-pl
maxCrumbs Max crumbs shown in breadcrumb. Max delimiter template can be customize with property maxCrumbTpl 100
showHidden Show hidden resources in breadcrumb 1
showContainer Show container resources in breadcrumb 1
showUnPub Show unpublished resources in breadcrumb 1
showCurrentCrumb Show current resource as a crumb 1
showBreadCrumbAtHome Show BreadCrumb on the home page 1
showHomeCrumb Show the home page as a crumb. Since 1.4.0-pl, the home crumb usage was simplified. The &showHomeCrumb=1 property adds the home crumb at the start of breadcrumb and &showHomeCrumb=0 hides it if present. 1
useWebLinkUrl Use the weblink url instead of the url to the weblink 1 1.0.0-beta3
direction Direction or breadcrumb : Left To Right (ltr) or Right To Left (rtl) for Arabic language for example ltr
scheme Format for how URLs are generated. Possible values are based on modX.makeUrl): modx link_tag_scheme setting

Valid scheme values:

  • -1 : (default value) URL is relative to site_url
  • 0 : see http
  • 1 : see https
  • full : URL is absolute, prepended with site_url from config
  • abs : URL is absolute, prepended with base_url from config
  • http : URL is absolute, forced to http scheme
  • https : URL is absolute, forced to https scheme

Templating properties

@CODE no longer supported since 1.4.0-pl. Use @INLINE instead.

Name Description Default Version
containerTpl Name of the chunk containing the template for the container of the breadcrumb. It also can be file path (@FILE ) or chunk code (@INLINE ). cf BreadCrumb.containerTpl
homeCrumbTpl Name of the chunk containing the template for the current crumb. It also can be file path (@FILE ) or chunk code (@INLINE ). cf BreadCrumb.homeCrumbTpl 1.4.0-pl
currentCrumbTpl Name of the chunk containing the template for the current crumb. It also can be file path (@FILE ) or chunk code (@INLINE ). cf BreadCrumb.currentCrumbTpl
linkCrumbTpl Name of the chunk containing the template for the default crumb. It also can be file path (@FILE ) or chunk code (@INLINE ). cf BreadCrumb.linkCrumbTpl
categoryCrumbTpl Name of the chunk containing the template for categories crumbs. Can be file (@FILE ) or code (@INLINE ). cf BreadCrumb.categoryCrumbTpl 1.3.2-beta1
maxCrumbTpl Name of the chunk containing the template for the max delimiter crumb. It also can be file path (@FILE ) or chunk code (@INLINE ). cf BreadCrumb.maxCrumbTpl

Examples

Show the breadcrumb of the current resource

[[BreadCrumb]]

Show the breadcrumb of the resource whose ID is 72

[[BreadCrumb? &to=`72`]]

Show home crumb at the start of breadcrumb

[[BreadCrumb? &showHomeCrumb=`1`]]

Show the breadcrumb of the resource whose ID is 72 from it's level 2 parent

[[BreadCrumb? &from=`[[UltimateParent? &topLevel=`2`]]` &to=`72`]]

Change the direction of the breadcrumb : rtl (Right To Left) or ltr (Left To Right)

[[BreadCrumb? &direction=`rtl`]]

Exclude some resources

[[BreadCrumb? &exclude=`23,135`]]

Use custom templates

[[BreadCrumb? &linkCrumbTpl=`myLinkCrumbTpl`]]
[[BreadCrumb? &linkCrumbTpl=`@INLINE <li><a href="[[+link]]">[[+pagetitle]]</a></li>`]]
[[BreadCrumb? &linkCrumbTpl=`@FILE [[++assets_path]]my_link_crumb_tpl.html`]]

Migrate from Breadcrumbs snippet

Once again, BreadCrumb was inspired by the Breadcrumbs snippet. Some of Breadcrumbs properties have been removed but you still can do the same things with BreadCrumb ... just in a different way.

crumbSeparator

Before:

[[Breadcrumbs? &crumbSeparator=`>`]]

Use CSS instead:

#breadcrumb li + li:before{
    content:  '>';
    margin:   0 2px;
}

Before:

[[Breadcrumbs? &currentAsLink=`1`]]

New:

[[BreadCrumb? &currentCrumbTpl=`myCurrentCrumbTpl`]]

Chunk myCurrentCrumbTpl:

<li><a href="[[+link]]">[[+pagetitle]]</a></li>

descField

Before:

[[Breadcrumbs? &descField=`longtitle`]]

New:

[[BreadCrumb? &linkCrumbTpl=`myLinkCrumbTpl` &currentCrumbTpl=`myCurrentCrumbTpl`]]

Chunks myLinkCrumbTpl and myCurrentCrumbTpl:

<li><a href="[[+link]]" title="[[+longtitle]]">[[+pagetitle]]</a></li>

homeCrumbDescription

Before:

[[Breadcrumbs? &homeCrumbDescription=`Home`]]

After:

[[BreadCrumb? &containerTpl=`myContainerTpl`]]

Chunk myContainerTpl:

<ul>
    <li><a href="[[++site_url]]">Home</a></li>
    [[+crumbs]]
</ul>

homeCrumbTitle

Before:

[[Breadcrumbs? &homeCrumbTitle=`Home`]]

After:

[[BreadCrumb? &containerTpl=`myContainerTpl`]]

Chunks myContainerTpl:

<ul>
    <li><a href="[[++site_url]]" title="Home">Home</a></li>
    [[+crumbs]]
</ul>

maxDelimiter

Before:

[[Breadcrumbs? &maxDelimiter=`(...)`]]

After:

[[BreadCrumb? &maxCrumbTpl=`myMaxCrumbTpl`]]

Chunk myMaxCrumbTpl:

<li>(...)</li>

titleField

Before:

[[Breadcrumbs? &titleField=`menutitle`]]

After:

[[BreadCrumb? &linkCrumbTpl=`myLinkCrumbTpl` &currentCrumbTpl=`myCurrentCrumbTpl`]]

Chunk myLinkCrumbTpl and myCurrentCrumbTpl:

<li><a href="[[+link]]">[[+menutitle]]</a></li>

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • eydolan
  • Lefthandmedia
  • Murray Wood
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$306 per month—let's make that $500!

Learn more