Изменеие навигации "Xлебная крошка" (breadcrumb)

1 декабря 2008 в 11:59
Аватар пользователя VVVi VVVi 0 2

Изменить навигацию "Xлебная крошка" (breadcrumb) можно с применением модулей таких как Custom Breadcrumbs Node breadcrumb Taxonomy Breadcrumb Menu Breadcrumb, а можно сделать это вручную собственно пример:
в template.php добавляем

function phptemplate_breadcrumb($breadcrumb) {

        $path = trim($_GET['q'], '/');
        $path = drupal_get_path_alias($path);
        $path = explode('/', $path);
       
        if ( $path[0] == 'user' ) {
            return '<div class="breadcrumb"><a href=/>Главная</a> > Пользователь</div>';
        }
        elseif ( $path[0] == 'offer' && $path[1] == 'add' ) {
            return '<div class="breadcrumb"><a href=/>Главная</a> > <a href=/offer>Предложение</a> > Добавить</div>';
        }
        elseif ( $path[0] == 'news' && $path[1] == '') {
            return '<div class="breadcrumb"><a href=/>Главная</a> > Новости</div>';
        }
       
// по типу ноды
        if ((arg(0) == 'node') && is_numeric(arg(1)) ) {
                $node = node_load(arg(1));
        }
        if ( $node->type == 'pm' ) {
            return '<div class="breadcrumb"><a href=/>Главная</a> > Сообщение</div>';
        }
        elseif ( $node->type == 'news' ) {
            return '<div class="breadcrumb"><a href=/>Главная</a> > <a href=/news>Новости</a></div>';
        }      
       
        if (!empty($breadcrumb)) {
            return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
        }
}

Комментарии