Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php和twitter引导的动态下拉菜单_Php_Html_Twitter Bootstrap - Fatal编程技术网

使用php和twitter引导的动态下拉菜单

使用php和twitter引导的动态下拉菜单,php,html,twitter-bootstrap,Php,Html,Twitter Bootstrap,谢谢你阅读。。。我有一个2层的导航。按好、坏和评论数对内容进行排序。如果用户点击good,它将带来另一个导航,该导航按时间对内容进行排序。比如今天,上一周,上一个月 我可以使用$\u SERVER['PHP\u SELF']添加class='active',但是twitter bootsrap下拉菜单没有简单的class='active'它很复杂。我想不出一个解决办法。我应该用它吗?弗雷奇?我不知道。请参见代码中的html命令。这是我的密码 <ul class="nav nav-tabs"

谢谢你阅读。。。我有一个2层的导航。按好、坏和评论数对内容进行排序。如果用户点击good,它将带来另一个导航,该导航按时间对内容进行排序。比如今天,上一周,上一个月

我可以使用
$\u SERVER['PHP\u SELF']
添加
class='active'
,但是twitter bootsrap下拉菜单没有简单的
class='active'
它很复杂。我想不出一个解决办法。我应该用它吗?弗雷奇?我不知道。请参见代码中的html命令。这是我的密码

<ul class="nav nav-tabs">
        <li <?php if (basename($_SERVER['PHP_SELF']) == '/?Top'): ?> class="active"<?php endif; ?>><a href="/?Top">Top Content</a></li> 
        <li <?php if (basename($_SERVER['PHP_SELF']) == '/?Bad'): ?> class="active"<?php endif; ?>><a href="/?Bad">Bad Content</a></li>
        <li <?php if (basename($_SERVER['PHP_SELF']) == '/?Comments'): ?> class="active"<?php endif; ?>><a href="/?Comments">Most Commented</a></li>
<!-- It's confusing me when It comes here... because as you see active option is not li tag. it's bunch of html code and also any url bellow can ben any of those up -->
          <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-time"></i> Today <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><a href="URL=week" />Last 1 Week</a></li>
              <li><a href="URL=month" />Last 1 Month </a></li>
              <li><a href="URL=all" />All</a></li>
            </ul>
          </li>
    </ul>
    > > >
html:当它来到这里时,我很困惑。。。因为正如你所看到的,活动li不是li,它是一堆html代码,而且下面的任何url也可以是上面的任何url。你可以使用
“活动”类作为辍学者
li
(其中一个有class
“dropdown”
),另一个
“活动”类作为你孩子的下拉列表

这是一个例子

<ul class="nav nav-tabs">
    <li class=""><a href="#">Home</a></li>
    <li><a href="#">Help</a></li>
    <li class="dropdown active">
      <a href="#" data-toggle="dropdown" class="dropdown-toggle">Dropdown <b class="caret"></b></a>
      <ul class="dropdown-menu">
        <li><a href="#">Action</a></li>
        <li class="active"><a href="#">Another action</a></li>
        <li><a href="#">Something else here</a></li>
        <li class="divider"></li>
        <li><a href="#">Separated link</a></li>
      </ul>
    </li>
  </ul>

一个现场演示

非常感谢。我不知道twitter bootsrap能做到这一点。谢谢