Breadcrumbs
Last updated: Feb 17, 2024

Breadcrumbs are a convenient way of showing the current hierarchy of the current page.
Breadcrumbs are built based upon the current segments in the URL.

You can use the breadcrumbs anywhere on your pages, in partials or layout files.

Just use $webigniter->getBreadCrumbs(), this will return an array of breadcrumbs with their names and links, also there is a 'last' key, which is true if the breadcrumb is the last one.

Here's a basic usage example:

<?php foreach($webigniter->getBreadCrumbs() as $breadCrumb):?>
  <span> / </span>
  <?php if(!$breadCrumb['last']):?>
    <a href="<?=$breadCrumb['link'];?>"> <?=$breadCrumb['name'];?></a>
  <?php else: ?>
    <span><?=$breadCrumb['name'];?></span>
  <?php endif; ?>
<?php endforeach; ?>

This will list all available breadcrumbs and make a link, except for the last (current page), that won't be a link.

1