首页 > 代码库 > 桂电在线-php-提取菜单到配置文件2
桂电在线-php-提取菜单到配置文件2
继续昨晚没完成的主菜单模板:
<!-- 菜单块 --> <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=http://www.mamicode.com/"<?=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=http://www.mamicode.com/"" 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=http://www.mamicode.com/"">"color: #0000ff">class="img-responsive"/></a> </div> <div class="col-xs-6 col-sm-3"> <a href=http://www.mamicode.com/"">"color: #0000ff">class="img-responsive"/></a> </div> <div class="col-xs-6 col-sm-3"> <a href=http://www.mamicode.com/"">"color: #0000ff">class="img-responsive"/></a> </div> <div class="col-xs-6 col-sm-3"> <a href=http://www.mamicode.com/"">"color: #0000ff">class="img-responsive"/></a> </div> </div> </section></div>
总结一下:
1.取模计数计数从1开始
2.权限点和菜单分开,需创建权限点文件
桂电在线-php-提取菜单到配置文件2
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。