BreadCrumb

Skip to end of metadata
Go to start of metadata

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.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: http://modx.com/extras/package/breadcrumb

Support, Comments, Development and Bug Reporting

Github : https://github.com/omycode/breadcrumb
Support/Comments : http://forums.modx.com/thread/71902/support-comments-for-breadcrumb

Usage

The BreadCrumb snippet can be called using the tag :

[[BreadCrumb]]

Breadcrumb properties

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
resourceId
(deprecated) Resource ID whose breadcrumb is created current resource ID
 
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 0
 
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
 

Templating properties

Name Description Default
containerTpl Name of the chunk containing the template for the container of the breadcrumb BreadCrumbContainerTpl
currentCrumbTpl Name of the chunk containing the template for the current crumb BreadCrumbCurrentCrumbTpl
linkCrumbTpl Name of the chunk containing the template for the default crumb BreadCrumbLinkCrumbTpl
maxCrumbTpl Name of the chunk containing the template for the max delimiter crumb BreadCrumbMaxCrumbTpl

Examples

Show the breadcrumb of the current resource

[[BreadCrumb]]

Show the breadcrumb of the resource whose ID is 72

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

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`]]

Use custom templates

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

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.

Removed Breadcrumb properties Previous Breadcrumbs usage
New BreadCrumb usage
crumbSeparator Tag :
[[Breadcrumbs? &crumbSeparator=`>`]]

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

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

Use template :

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

Chunk myCurrentCrumbTpl :

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

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

Use template :

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

Chunks myLinkCrumbTpl and myCurrentCrumbTpl :

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

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

Use template :

Tag :

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

Chunks myContainerTpl :

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

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

Use template :

Tag :

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


Chunks myContainerTpl :

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

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


Use template :

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

Chunk myMaxCrumbTpl :

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

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

Use template :

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

Chunk myLinkCrumbTpl and myCurrentCrumbTpl :

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

See Also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.