ThinkCMF5.1导航菜单自定义调用
<php> $navMenuModel = new \app\admin\model\NavMenuModel(); $menus = $navMenuModel->navMenusTreeArray('2'); </php> <volist name="menus" id="vo"> <a href="{$vo['href']}" target="{$vo['target']}">{$vo['name']}</a> </volist>
subNavMenusTreeArray()为生成前台导航的子导航。综合案例(自定义三级导航):
<ul> <php> $navMenuModel = new \app\admin\model\NavMenuModel(); $menus = $navMenuModel->navMenusTreeArray('1'); </php> <volist name="menus" id="vo"> <php> $submenus = $navMenuModel->subNavMenusTreeArray($vo['id']); </php> <li> <a href="{$vo['href']}" target="{$vo['target']}" class="nav-title">{$vo['name']}</a> <dl> <div class="duoji-nav"> <volist name="submenus" id="subvo"> <dd> <ul> <li style="color:blue !important; font-size: 18px !important;"> {$subvo.name} </li> <php> $submenus2 = $navMenuModel->subNavMenusTreeArray($subvo['id']); </php> <volist name="submenus2" id="subvo2"> <li> <a href="{$subvo2['href']}">{$subvo2.name}</a> </li> </volist> </ul> </dd> </volist> </div> </dl> </li> </volist> </ul>