码迷,mamicode.com
首页 > Web开发 > 详细

桂电在线-php-提取菜单到配置文件2

时间:2014-12-30 11:36:50      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:

继续昨晚没完成的主菜单模板:

<!-- 菜单块 -->
    <div class="on-light" id="menus">
        <?php foreach ($menus as $menu_key => $menu): ?>

        <?php 
            // 排除校园名片
            if ($menu_key == ‘card‘) 
                break;
        ?>

        <section class="container" id="<?=$menu_key?>-menus">
            <header class="col-xs-12 text-center">
                <h2 class="bs-docs-featurette-title"><?=$menu[‘name‘]?></h2>
                <p class="lead"><?=$menu[‘description‘]?></p>
            </header>

            <div class="row bs-docs-featured-sites">
                
            <?php foreach( $menu[‘submenus‘] as $key => $submenu ): ?> 
                <?php $i = $key + 1; ?>
                <div class="col-xs-6 col-sm-3">
                    <a href="<?=site_url( $submenu[‘link‘] )?>" class="menu menu<?=$i?>"><?=$submenu[‘name‘]?></a>
                </div> 

                <?php  
                    // 如果存在下一个子菜单 && 取模等于0
                    $next_sm = next($menu[‘submenus‘]);
                ?>                
                <?php if( isset($next_sm) && $i % 4 == 0 ): ?>
                </div>
                <div class="row bs-docs-featured-sites">
                <?php endif ?>

            <?php endforeach ?>

            </div>
        </section>            
        <?php endforeach ?>

    <section class="container" id="cards-menus">
        <header class="col-xs-12 text-center">
            <h2 class="bs-docs-featurette-title">校园名片</h2>
            <p class="lead">校内朋友圈,你可能认识他们喔!?</p>
        </header>
        <!-- 杰出校友 -->
        <div class="row text-right">
            <div class="col-xs-12 text-right">
                <a href="" class="btn btn-primary">
                    更多校友
                    <i class="glyphicon glyphicon-chevron-right"></i>
                </a>
            </div>
        </div>
        <div class="row bs-docs-featured-sites">
            <div class="col-xs-6 col-sm-3">
                <a href="">
                    <img src="<?=__PUBLIC__?>images/test.jpg" alt="" class="img-responsive"/></a>
            </div>
            <div class="col-xs-6 col-sm-3">
                <a href="">
                    <img src="<?=__PUBLIC__?>images/test.jpg" alt="" class="img-responsive"/></a>
            </div>
            <div class="col-xs-6 col-sm-3">
                <a href="">
                    <img src="<?=__PUBLIC__?>images/test.jpg" alt="" class="img-responsive"/></a>
            </div>
            <div class="col-xs-6 col-sm-3">
                <a href="">
                    <img src="<?=__PUBLIC__?>images/test.jpg" alt="" class="img-responsive"/></a>
            </div>
        </div>
    </section>
</div>

总结一下:

1.取模计数计数从1开始

2.权限点和菜单分开,需创建权限点文件

桂电在线-php-提取菜单到配置文件2

标签:

原文地址:http://www.cnblogs.com/jdhu/p/4193101.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!