Skip to content

Instantly share code, notes, and snippets.

@HaeckDesign
Last active December 16, 2016 06:55
Show Gist options
  • Select an option

  • Save HaeckDesign/2b14dfacfddf3e58e35a to your computer and use it in GitHub Desktop.

Select an option

Save HaeckDesign/2b14dfacfddf3e58e35a to your computer and use it in GitHub Desktop.

Revisions

  1. HaeckDesign renamed this gist Jul 31, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. HaeckDesign revised this gist Jul 31, 2015. No changes.
  3. HaeckDesign created this gist Jul 31, 2015.
    66 changes: 66 additions & 0 deletions default.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    <?php
    defined('_JEXEC') or die;
    ?>

    <ol itemscope itemtype="http://schema.org/BreadcrumbList" class="uk-breadcrumb uk-margin uk-link-muted <?php echo $moduleclass_sfx; ?>">
    <?php
    if ($params->get('showHere', 1))
    {
    echo '<li itemprop="itemListElement" itemscope
    itemtype="http://schema.org/ListItem" class="uk-active">' . JText::_('MOD_BREADCRUMBS_HERE') . '</li>';
    }
    else
    {
    echo '<li><i class="uk-icon-home"></i></li>';
    }

    // Get rid of duplicated entries on trail including home page when using multilanguage
    for ($i = 0; $i < $count; $i++)
    {
    if ($i == 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link == $list[$i - 1]->link)
    {
    unset($list[$i]);
    }
    }

    // Find last and penultimate items in breadcrumbs list
    end($list);
    $last_item_key = key($list);
    prev($list);
    $penult_item_key = key($list);

    // Make a link if not the last item in the breadcrumbs
    $show_last = $params->get('showLast', 1);

    // Generate the trail
    foreach ($list as $key => $item) :
    if ($key != $last_item_key)
    {
    // Render all but last item - along with separator
    echo '<li itemprop="itemListElement" itemscope
    itemtype="http://schema.org/ListItem">';
    if (!empty($item->link))
    {
    echo '<a href="' . $item->link . '" title="' . $item->name . '" itemprop="item"><span itemprop="name">' . $item->name . '</span></a>';
    }
    else
    {
    echo '<span itemprop="name">' . $item->name . '</span>';
    }

    if (($key != $penult_item_key) || $show_last)
    {
    echo '';
    }

    echo '</li>';
    }
    elseif ($show_last)
    {
    // Render last item if reqd.
    echo '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" class="uk-active" ><span itemprop="name">';
    echo $item->name;
    echo '<link itemprop="url" href="' . $item->link . '"/></span></li>';
    }
    endforeach; ?>
    </ol>