02 Dec 2011

Hide K2 category in breacrumbs

por  Roberto Segura

Sometimes in the item view we don't want to display the item category on the breadcrumbs. I think this should be parametrized on item and categories in the next releases. This article describes the "dirty" modification needed to achieve this.

 WARNING: As this isn't parametrized you will remove the category link for all the items views.

 The modification is simple. Just edit the file:

components/com_k2/views/item/view.html.php

and around line 240 replace:

Ver código
//Set pathway
        $menus = &JSite::getMenu();
        $menu = $menus->getActive();
        $pathway = &$mainframe->getPathWay();
        if($menu) {
            if($menu->query['view']!='item' || $menu->query['id']!= $item->id){
                if(!isset($menu->query['task']) || $menu->query['task']!='category' || $menu->query['id']!= $item->catid)
                $pathway->addItem($item->category->name, $item->category->link);
                $pathway->addItem($item->title, '');
            }
        }

with:

Ver código
//Set pathway
        $menus = &JSite::getMenu();
        $menu = $menus->getActive();
        $pathway = &$mainframe->getPathWay();
        if($menu) {
            if($menu->query['view']!='item' || $menu->query['id']!= $item->id){
                if(!isset($menu->query['task']) || $menu->query['task']!='category' || $menu->query['id']!= $item->catid)
                // Domatix: do not add item category to breadcrumbs 
                //$pathway->addItem($item->category->name, $item->category->link);
                $pathway->addItem($item->title, '');
            }
        }
 

As we are modifying the K2 core files you will lose changes when you update your K2.

Dejar comentario

Los campos marcados con (*) son obligatorios.

Domatix Technologies, S.L.U. - C/Espinosa 8 - 46008 - Valencia - Telf.: 963 230 962
Delegación Murcia - C/Juan de Juanes 4 - 30740 - San Pedro del Pinatar - Murcia