PhileBreadcrumbs
A PhileCMS plugin that generates
breadcrumbs. The plugin returns an array and adds no markup allowing you to use
it how you want., (*1)
1. Installation
Install via composer, (*2)
php composer.phar require gibbs/phile-breadcrumbs:1.*
Install via git, (*3)
Clone this repository from the phile
directory into
plugins/gibbs/phileBreadcrumbs
. E.g:, (*4)
git clone git@github.com:Gibbs/phileBreadcrumbs.git plugins/gibbs/phileBreadcrumbs
Manual Install, (*5)
Download and extract the contents into: plugins/gibbs/phileBreadcrumbs
, (*6)
2. Plugin Activation
Activate the plugin in your config.php
file:, (*7)
$config['plugins']['gibbs\\phileBreadcrumbs'] = array('active' => true);
3. Examples
When the plugin is enabled a breadcrumbs
variable becomes available to
your themes. The breadcrumbs
variable contains the following:, (*8)
-
active
(true or false). The last item/crumb is true.
-
meta
. The crumbs parsed meta data. You can use any meta data.
-
uri
. The crumbs relative URL.
-
url
. The crumbs absolute URL.
Minimal Example, (*9)
{% for crumb in breadcrumbs %}
<a href="{{ crumb.url }}">{{ crumb.meta.title }}</a>
{% endfor %}
Bootstrap 3 Example, (*10)
<ol class="breadcrumb">
{% for crumb in breadcrumbs %}
{% if crumb.active %}
<li class="active">{{ crumb.meta.title }}</li>
{% else %}
<li><a href="{{ crumb.uri }}">{{ crumb.meta.title }}</a></li>
{% endif %}
{% endfor %}
</ol>
Foundation 5 Example, (*11)
<ul class="breadcrumbs">
{% for crumb in breadcrumbs %}
{% if crumb.active %}
<li class="current"><a href="{{ crumb.uri }}">{{ crumb.meta.title }}</a></li>
{% else %}
<li><a href="{{ crumb.uri }}">{{ crumb.meta.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
Semantic UI Example, (*12)
<div class="ui breadcrumb">
{% for crumb in breadcrumbs %}
{% if crumb.active %}
<div class="active section">{{ crumb.meta.title }}</div>
{% else %}
<a href="{{ crumb.uri }}" class="section">{{ crumb.meta.title }}</a>
<span class="divider"> / </span>
{% endif %}
{% endfor %}
</div>