继续昨晚没完成的主菜单模板:
<!-- 菜单块 --> <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.权限点和菜单分开,需创建权限点文件