You need:
- Create split-level menu.
- The upper string is main items (first level), and sub-menu appears to the left of the selected item.
- Parent item from main menu items is active when navigation through submenus.
Solution:
We need to form one menu creating its structure through selection of parent items, and then make the same menu primary and secondary in menu settings and add location of these menus in the form of ‘links’in page.tpl.php.
Please follow step-by-step instructions to do this::
- GO to Administer → Site Building → Menus
- Create menu (you can create the required items just in primary links – menu is already created by default). To make menu split-level, select parents for menu items. Do nor create 2 different menus.
- Open Settings tab and select:
Menu with primary links: your menu (Primary links)
Menu with secondary links: your menu (Primary links)
- Insert the following code to page.tpl.php:
For primary_links
<?php if (isset($primary_links)) { ?><?php print theme(‘links’, $primary_links) ?><?php } ?>
For secondary_links:
<?php if (isset($secondary_links)) { ?><?php print theme(‘links’, $secondary_links) ?><?php } ?>
This method can be used for two-level hierarchy i.e. there are upper items and left items. No other submenus – secondary menu won’t show them.
We will use TemplatePHP snippet from this page to create parent link with class="active". Insert the following code (without closing ?>
) to template.php.
<?php
function phptemplate_links($links, $attributes = array()) {
if (!count($links)) {
return ”;
}
$level_tmp = explode(‘-’, key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-$level ".$attributes['class']. "\">\n";
foreach ($links as $index => $link) {
$output .= ‘<li’;
if (stristr($index, ‘active’)) {
$output .= ‘ class="active"’;
}// frontpage AND current-link in menu is <front>
elseif((drupal_is_front_page()) && ($link['href']==’<front>’)){
$link['attributes']['class'] = ‘active’;//add class active to <li
$output .= ‘ class="active"’;//add class active to <a
}
$output .= ">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."</li>\n";
}
$output .= ‘</ul>’;
return $output;
}
?>
分享到:
相关推荐
git clone https://github.com/nhoag/docker-drupal.gitcd ./docker-drupal/exampledrush dl --drupal-project-rename=app drupaldocker-compose up然后在浏览器中访问 http://{boot2docker-ip}:8080:延长可以通过...
关于DropzoneJS这是DropzoneJS的Drupal 8集成。 ###如何安装:下载此模块下载DropzoneJS并将其放置在库文件夹中以通常方式安装dropzonejs删除“ test”文件夹f关于DropzoneJS这是DropzoneJS的Drupal 8集成。 ###如何...
This will create a new directory drupal-x.x/ containing all Drupal files and directories. Move the contents of that directory into a directory within your web server's document root or your public ...
DRUPAL新书 USING DRUPAL 英文原版 最好的Drupal教材 亚马逊4.5星推荐 http://www.amazon.com/Using-Drupal-Angela-Byron/dp/0596515804
nuxtjs-drupal-ce-Nuxt.js Drupal自定义元素连接器 通过自定义元素轻松将Nuxt.js连接到Drupal。 请参阅了解更多信息。 先决条件 安装了模块的后端。 设置 将nuxtjs-drupal-ce依赖项添加到您的Nuxt.js项目 yarn ...
Acquia drupal的初学者资料 Acquia Drupal is a commercially supported distribution of the open source Drupal ...Acquia Drupal offers you an advanced starting point to quickly begin building Drupal websites
Xowl-service客户端,用于drupal 7 该客户端使您可以通过语义层将托管的内容丰富到Drupal中。 您可以在此处在线测试此服务: : 要求 Drupal 7核心: : Drupal 7的模块ckeditor: ://ftp.drupal.org/files/...
头盔图:Drupal 。 这些是利用Helm安装Drupal的说明。 该图表将使您可以设置和配置Drupal以及其他集成: 使用ProxySQL配置MySQL 使用PGBouncer配置的PostgreSQL 雷迪斯漆请查阅我们的体系结构图以获取有关Azure的...
解压密码在:http://www.pin5i.com/showtopic-drupal-chinese-tutorial-e-book-download-drupal-building-website-technical-manuals-pdf.html
If you haven't already, I recommend you decide on a single URL for your blog and redirect visitors using other options. This will increase your search engine ranking and in the process help solve ...
与 CKAN 集成的 Drupal 7 发行版 安装 要使用这个 drupal 发行版,您需要有一个 LAMP 堆栈和一个有效的 drush 安装。 有关详细要求,请参阅 。 您可以从这里获取 drush 及其安装说明: : 理清要求后,您可以使用...
Drupal is now the world’s #1 open source content management system: Thousands of individuals and organizations are using it to build and update Web sites of virtually every kind. As Web designers and...
在您的composer.json文件中添加"amarie88/robo-drupal-coding": "~0.1" : { " require-dev " : { " amarie88/robo-drupal-coding " : " ~0.1 " } } 并执行composer update 。 或者 composer require --dev ...
The book covers what Drupal is, using Drupal when building a new web site, installing and configuring Drupal, creating and managing content, managing users, adding functionality to your web site ...
基于drupal-composer/drupal-project Drupal 8 drupal-composer/drupal-project 。 该项目由许多不同的存储库组成,下图概述了它们之间的关系。 用于定义和构建项目。 有关详细信息,请参见composer.json 。 该存储...
10 Drupal UX Powerups 1. 登录/注册 查看 使用 尝试 , , 2. 表格验证 查看 使用 、 (谨慎)、电子邮件、日期等(+ 或 ) 尝试: , , 3. 错误信息 使用 (小心!)尝试: ...
dr7-drupal-runner-example 用于测试Drupal Runner的最小香草 7构建设置。设置默认情况下,这个版本的配置将安装到所提供的本地虚拟主机名为dr7.druphpet.dev ,使用@ dr7.druphpet Drush别名。 在使用Drupal Runner...
Drupal:即将推出-模块Views Card D7中的子模块-您将能够启用该模块并创建视图。 样式在视图中定义。 B.不是Drupal: 参考byu功能卡的js和css文件:js: ://cdn.byu.edu/byu-feature-card/1.xx/byu-feature-card....
Drupal 安装程序 这是一个简单的 Composer 包,它将在 Composer 项目的根目录下安装 Drupal。 Drupal 不直接包含在这个项目中。 它是从 drupal.org 网站下载的。 使用这个 Composer 包安装 Drupal: 不习惯作曲家...
您的Drupal环境可在以下http://{username}.drupal.train-headless.4kclass.com/获得: http://{username}.drupal.train-headless.4kclass.com/ 管理用户是使用密码admin Four Kitchens 对于无密码身份验证,请...