简体   繁体   中英

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>

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(); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM