我正在准备将 Twitter 的 Bootstrap 顶部菜单调整为 Drupal 菜单系统。直到现在,都没有成功。我正在使用 Drupal 模块nicemenus在下拉列表中显示它们。
这是使用 Bootstrap 的 css 手工制作的菜单列表:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner" style="padding-left: 0px;">
<div class="container">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 1
<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#"><i class="icon-star"></i> Item 1</a></li>
<li><a href="#"><i class="icon-star"></i> Item 2</a></li>
</ul>
</li>
<li><a href="#">Normal Menu Link without dropdown</a></li>
</ul>
</div>
</div>
</div>
这是带有 nicemenus 的菜单输出,您可以看到 Bootstrap 更容易理解。
<div id="block-nice-menus-1" class="block block-nice-menus block-1 block-nice-menus-1 odd block-without-title">
<div class="block-inner clearfix">
<div class="content clearfix">
<ul id="nice-menu-1" class="nice-menu nice-menu-down sf-js-enabled">
<li class="menu-5674 menu-path-liganetnet first odd"><a href="">Link without Dropdowns</a></li>
<li class="menu-267 menuparent menu-path-front even"><a style="dropdown" class="dropdown active" href="/">Dropdown Link 1</a>
<ul style="display: none; visibility: hidden;">
<li class="menu-2280 menu-path-node-196 first odd "><a href="">Item 1</a></li>
<li class="menu-270 menu-path-node-197 even "><a title="" href="">Item 2</a></li>
<li class="menu-271 menu-path-node-1464 odd last "><a title="" href="">Item 3</a></li>
</ul>
</li>
<li class="menu-268 menuparent menu-path-front odd"><a class="active" href="/">Dropdown Link 2</a>
<ul style="display: none; visibility: hidden;">
<li class="menu-274 menu-path-node-214 first odd "><a title="" href="">Item 1</a></li>
<li class="menu-273 menu-path-node-213 even "><a title="" href="">Item 2</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
我已经安装了 menu_attributes 模块,但是当我添加一些类时,它们只会添加到标签中。如何以编程方式转换这些 CSS 类?
做一个 print_r(),我发现了这个:
[sidebar_second] => Array
(
[nice_menus_1] => Array
(
[#markup] =>
Link 1 without Dropdown
Dropdown 1
Dropdown 2
Dropdown 3
[#contextual_links] => Array
(
[block] => Array
(
[0] => admin/structure/block/manage
[1] => Array
(
[0] => nice_menus
[1] => 1
)
)
)
[#block] => stdClass Object
(
[module] => nice_menus
[delta] => 1
[theme] => liganet
[status] => 1
[weight] => -62
[region] => sidebar_second
[custom] => 0
[visibility] => 0
[pages] =>
[title] =>
[bid] => 744
[cache] => -1
[subject] =>
)
我认为可以通过在页面模板中打印父菜单变量然后在类中打印子变量来完成?我怎么能用 php 做到这一点?
谢谢你的帮助!