zoukankan      html  css  js  c++  java
  • ThinkCMF-首页Nav部分菜单配置详解

    Nav菜单代码放在了 /themes/simplebootx/Public/nav.html

    具体代码:

    <?php
    			$effected_id="main-menu";
    		  	$filetpl="<a href='$href' target='$target'>$label</a>";
    		  	$foldertpl="<a href='$href' target='$target' class='dropdown-toggle' data-toggle='dropdown'>$label <b class='caret'></b></a>";
    		  	$ul_class="dropdown-menu" ;
    		  	$li_class="" ;
    		  	$style="nav";
    		  	$showlevel=6;
    		  	$dropdown='dropdown';
    		  	echo sp_get_menu("main",$effected_id,$filetpl,$foldertpl,$ul_class,$li_class,$style,$showlevel,$dropdown);
    		?>
    

     其中"main"表示要获取菜单分类为主菜单下的所有active为1的菜单

    function sp_get_menu($id="main",$effected_id="mainmenu",$filetpl="<span class='file'>$label</span>",$foldertpl="<span class='folder'>$label</span>",$ul_class="" ,$li_class="" ,$style="filetree",$showlevel=6,$dropdown='hasChild'){
    	$navs=F("site_nav_".$id);
    	if(empty($navs)){
    		$navs=_sp_get_menu_datas($id);
    	}
    	import("Tree");
    	$tree = new Tree();
    	$tree->init($navs);
    	return $tree->get_treeview_menu(0,$effected_id, $filetpl, $foldertpl,  $showlevel,$ul_class,$li_class,  $style,  1, FALSE, $dropdown);
    }
    
    
    function _sp_get_menu_datas($id){
    	$nav_obj= M("Nav");
    	$oldid=$id;
    	$id= intval($id);
    	$id = empty($id)?"main":$id;
    	if($id=="main"){
    		$navcat_obj= M("NavCat");
    		$main=$navcat_obj->where("active=1")->find(); //挑选出主菜单
    		$id=$main['navcid'];
    	}
    
    	if(empty($id)){
    		return array();
    	}
            ......
    }
    

     $effected_id="main-menu" 表示生成的ul元素的id

  • 相关阅读:
    Python如何编写一个带命令行参数的程序
    软件工程第二次作业----(1)补交
    软件工程第二次作业----
    2017软件工程第一次作业
    2017软件工程第三次作业--功能测试
    2017软件工程第三次作业--效能分析
    每周例行报告
    2017软件工程第二次作业(一)
    2017软件工程第二次作业(二)
    2017软件工程第一次作业
  • 原文地址:https://www.cnblogs.com/jinguodong/p/6057762.html
Copyright © 2011-2022 走看看