Search code examples
phpjoomlavirtuemartbreadcrumbs

How to get Joomla breadcrumb value?


I need breadcrub value in footer. How i can get that value?

Following code is in mytheme/html/mod_breadcrumbs/default.php

How i can get that value like that home/Category1/Subcategory

<?php

// no direct access
defined('_JEXEC') or die;

?>

<div class="breadcrumbs<?php echo $moduleclass_sfx; ?>">
<?php 
    echo '<ul>';
    for ($i = 0; $i < $count; $i ++) {
        // If not the last item in the breadcrumbs add the separator
        if ($i < $count -1) {
            if (!empty($list[$i]->link)) echo '<li><a href="'.$list[$i]->link.'" class="pathway">'.$list[$i]->name.'</a></li>';
            else echo '<li class="pathway">' . $list[$i]->name . '</li>';
            if($i < $count -2) echo ' <li class="pathway separator">></li> ';
        } else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true
            if($i > 0) echo ' <li class="pathway separator">></li> ';
            echo '<li class="pathway">' . $list[$i]->name . '</li>';
        }
    } 
    echo '</ul>';
?>
</div>

Solution

  • Hi I've solved with SESSION

    Assing new Variable $pth

    echo '<ul>';
    
            for ($i = 0; $i < $count; $i ++) {
                // If not the last item in the breadcrumbs add the separator
                if ($i < $count -1) {
                    if (!empty($list[$i]->link)) echo '<li><a href="'.$list[$i]->link.'" class="pathway">'.$list[$i]->name.'</a></li>';
                    else echo '<li class="pathway">' . $list[$i]->name . '</li>';
        $pth.= $list[$i]->name . '/';
                    if($i < $count -2) echo ' <li class="pathway separator">></li> ';
                } else if ($params->get('showLast', 1)) { // when $i == $count -1 and 'showLast' is true
                    if($i > 0) echo ' <li class="pathway separator">></li> ';
                    echo '<li class="pathway">' . $list[$i]->name . '</li>';
        $pth.= $list[$i]->name;
                }
            } 
            echo '</ul>';
    
    
    
    session_start();
    $_SESSION['path'] = $pth;
    echo $_SESSION['path'];
    session_destroy();