Download the PHP package jinnguyen/puja-breadcrumb without Composer
On this page you can find all versions of the php package jinnguyen/puja-breadcrumb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jinnguyen/puja-breadcrumb
More information about jinnguyen/puja-breadcrumb
Files in jinnguyen/puja-breadcrumb
Package puja-breadcrumb
Short Description Puja-Breadcrumb is a simple class to manage the breadcrumbs
License Apache License 2.0
Informations about the package puja-breadcrumb
puja-breadcrumb
Puja-Breadcrumb is a simple class to manage the breadcrumbs
Installation
Just run this on the command line:
Usage
Examples:
Simple
$breadcrumb = new Breadcrumb; $breadcrumb->add('Subpage 2', '/subpage2'); echo $breadcrumb->render();
new breadcrumb with a array
$breadcrumb = new Breadcrumb(array( array('title' => 'Home', 'link' => '/'), array('title' => 'Page', 'link' => '/page'), array('title' => 'Subpage', 'link' => '/subpage/?a=5&b[]=7&b[]=8'), )); $breadcrumb->add('Subpage 2', '/subpage2'); echo $breadcrumb->render();
The rest of the documentation will assume you have a $breadcrumb
instance on which you are making calls.
Adding a crumb
Delete all crumb
Delete last crumb
Count breadcrumb elements
Check empty
Get data:
First and Last CSS classes
- Home // First Breadcrumb element
- Page
- Subpage
- Subpage 2 // Last Breadcrumb Element
The first/last css classes are the class of first/last Breadcrumb element
The Element
The default breadcrumb element is <li class="{FirstLastCss}">%s{Divider}</li>
. To change it, use the setElement method like so:
Note:
"%s" is required for Breadcrumb::$element {FirstLastCss}: will be replaced by Breadcrumb::$firstCssClassName for first element and Breadcrumb::$lastCssClassName for last element {Divider}: will be replaced by Breadcrumb::$divider
The List Element
The default list element used to wrap the breadcrumbs, is <ul>%s</ul>
. To change it, use the setListElement method like so:
Note:
"%s" is required for Breadcrumb::$listElement
Divider
The default breadcrumb divider is ` (empty). This will be replace to placeholder {Divider} in property Breadcrumb::$element. If you'd like to change it to, for example,
/`, you can just do:
Output
Finally, when you actually want to display your breadcrumbs, all you need to do is call the render()
method on the instance:
Note that by default crumb titles are rendered with escaping HTML characters, if you'd like to ignore it just do like so: