zoukankan      html  css  js  c++  java
  • (MoMoCMS教程9)列表页面侧栏的个性化定制2——侧栏显示当前二级子菜单

    且看如下图

    如果我们要达到这样的效果,应该如何去做呢?且看我的步骤,

    首先我们在后台添加一个新的主菜单和子菜单

    当前前台这样显示,

    按照我上面一篇博客的步骤,个性化侧栏,效果如下

    增加3个页面的个性化定制,


    **************************前方高能*********************

    接下来,需要你有编程知识了,这也是作为一名站长应有的基本素质,且看下面,

    主菜单编程:(添加到'百度产品'挂件中)

    <a class="list-group-item top"><?php echo $arr_main['title'];?></a>
    <?php
    	$sql="select * from ".DB_PREFIX."pages where pid=".$arr_main['id']." order by sort desc";
    	$query=$db->query($sql);
    	$num=$query->rowCount();
    	if($num>0){
    	while($arr=$query->fetch()){
    ?>
            <a class="list-group-item list" href="
            	<?php
            		echo URL.'/contents/'.$arr_main['id'].'/nd/'.$arr['id'];	
            	?>
            	">
              <?php echo $arr['title']; ?> <span class="pull-right small glyphicon glyphicon-chevron-right leftSideBar"></span>
            </a>
    <?php	}}	?>
    <div style="clear:both;margin-bottom:10px"></div>
    

    子菜单编程:(分别添加到'百度网盘'和'百度搜索'挂件中)

    <a class="list-group-item top"><?php echo $arr_main['title'];?></a>
    <?php
    	$sql="select * from ".DB_PREFIX."pages where pid=".$arr_main['id']." order by sort desc";
    	$query=$db->query($sql);
    	$num=$query->rowCount();
    	if($num>0){
    	while($arr=$query->fetch()){
    ?>
            <a style="<?php if($_GET['nd']==$arr['id']){echo 'background:#f5f5f5';} ?>" class="list-group-item list" href="
            	<?php
            		echo URL.'/contents/'.$arr_main['id'].'/nd/'.$arr['id'];	
            	?>
            	">
              <?php echo $arr['title']; ?> <span class="pull-right small glyphicon glyphicon-chevron-right leftSideBar"></span>
            </a>
    <?php	}}	?>
    <div style="clear:both;margin-bottom:10px"></div>
    

    回到前台,效果

  • 相关阅读:
    C#:友元程序集
    C#/Net代码精简优化技巧(3)
    Net4.0AspNet中URL重写的改进
    JQuery boxy插件的确认框在AspNet中的应用
    在数据库中将字表中的多行合并到一列中
    软件推荐:磁盘搜索软件Everything
    Net4.0对HTML净化的处理
    C#/Net代码精简优化技巧(2)
    推荐两款富文本编辑器:NicEdit和Kindeditor
    ASP.NET MVC+EF框架+EasyUI实现权限管理系列(11)验证码实现和底层修改
  • 原文地址:https://www.cnblogs.com/youcle/p/6003577.html
Copyright © 2011-2022 走看看