zoukankan      html  css  js  c++  java
  • HDCMS导航高亮显示!解决办法

    第一种方法:(传递class)

    <channel type='top' row='8' class='cur' >
        <li class='{$field.class}'>
           <h3><a href='' class="{$field.caturl}">{$field.catname}</a></h3>
        </li>
    </channel>

    第二种方法:写公共函数 functions.php

    hd / Common / Functions / functions.php

    //分类列表获得PID
    function allList($pid = 0){
      if($pid == 0){
        return false;
      }
      $category = M('category')->where(array('cid'=>$pid))->field('cid,pid')->find();  
      $cate = $category['pid'] ? allList($category['pid']):$category['cid'];
      return $cate;
    }

    循环遍历:

    <channel type='top' row='8'>
        <li class="<?php if($field['cid'] == allList($_GET['cid'])): ?><?php echo 'dlHover' ?><?php endif; ?>">
           <h3><a href='' class="{$field.caturl}">{$field.catname}</a></h3>
        </li>
    </channel>

    使用下来,第二种方法更灵活,适用于二级分类和三级分类;

  • 相关阅读:
    [HAOI2015]T2
    bzoj1036:[ZJOI2008]树的统计Count
    苹果树
    poj1151 Atlantis
    1593: [Usaco2008 Feb]Hotel 旅馆
    [JSOI2008]最大数maxnumber
    【HNOI2014】米特运输
    【HNOI2013】数列
    Luogu5221 Product
    【CQOI2014】数三角形
  • 原文地址:https://www.cnblogs.com/e0yu/p/7244119.html
Copyright © 2011-2022 走看看