ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
官方写的太烂了,本来想自己写呢,碍于时间的问题,将来再写! ``` <div id="nav-wrapper"> <ul class="nav nav-list"> {:getsubmenu($submenus)} </ul> </div> ``` 模板遍历 ``` <php>$submenus=$menus;</php> <php>function getsubmenu($submenus){</php> <notempty name="submenus"> <php>foreach($submenus as $menu){</php> <li> <php> $menu_name=lang($menu['lang']); $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name; </php> <php>if(empty($menu['items'])){</php> <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);"> <i class="fa fa-{$menu.icon|default='desktop'}"></i> <span class="menu-text"> {$menu_name} </span> </a> <php>}else{</php> <a href="#" class="dropdown-toggle"> <i class="fa fa-{$menu.icon|default='desktop'} normal"></i> <span class="menu-text normal"> {$menu_name} </span> <b class="arrow fa fa-angle-right normal"></b> <i class="fa fa-reply back"></i> <span class="menu-text back">返回</span> </a> <ul class="submenu"> <php>getsubmenu1($menu['items'])</php> </ul> <php>}</php> </li> <php>}</php> </notempty> <php>}</php> <php>function getsubmenu1($submenus){</php> <php>foreach($submenus as $menu){</php> <li> <php> $menu_name=lang($menu['lang']); $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name; </php> <php>if(empty($menu['items'])){</php> <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);"> <i class="fa fa-caret-right"></i> <span class="menu-text"> {$menu_name} </span> </a> <php>}else{</php> <a href="#" class="dropdown-toggle"> <i class="fa fa-caret-right"></i> <span class="menu-text"> {$menu_name} </span> <b class="arrow fa fa-angle-right"></b> </a> <ul class="submenu"> <php>getsubmenu2($menu['items'])</php> </ul> <php>}</php> </li> <php>}</php> <php>}</php> <php>function getsubmenu2($submenus){</php> <php>foreach($submenus as $menu){</php> <li> <php> $menu_name=lang($menu['lang']); $menu_name=$menu['lang']==$menu_name?$menu['name']:$menu_name; </php> <a href="javascript:openapp('{$menu.url}','{$menu.id}','{$menu_name}',true);"> &nbsp;<i class="fa fa-angle-double-right"></i> <span class="menu-text"> {$menu_name} </span> </a> </li> <php>}</php> <php>}</php> ```