Scripts 学盟
标题: phpcms 联动菜单无限级GET标签调用代码 [打印本页]
作者: 莺子 时间: 2012-12-14 15:45:46 标题: phpcms 联动菜单无限级GET标签调用代码
{pc:get sql="SELECT * FROM `v9_linkage` WHERE parentid=0 AND keyid=1 ORDER BY listorder ASC" num="100" return="data" }<!--调用条件说明:parentid=0,父级ID(默认联动菜单“中国”);keyid=1,菜单ID,添加字段时使用那个的ID-->
{loop $data $n $v}
<li>
<h2><a href="{$v['linkageid']}" title="{$v['name']}" target="_blank">{$v['name']}</a></h2>
<ul>
<!--二级调用-->
{pc:get sql="SELECT * FROM `v9_linkage` WHERE parentid=$v[linkageid] ORDER BY listorder ASC" num="100" return="smenu" }
{loop $smenu $n $m}
<li>
<h3><a href="{$m['linkageid']}" title="{$m['name']}" target="_blank">{$m['name']}</a></h3>
<!--三级调用 如此循环可以调用4级、5级.....无限级分类-->
{pc:get sql="SELECT * FROM `v9_linkage` WHERE parentid=$m[linkageid] ORDER BY listorder ASC" num="100" return="tmenu" }
<h4>
{loop $tmenu $n $r}
<a href="{$r['linkageid']}" title="{$r['name']}" target="_blank">{$r['name']}</a>
{/loop}
</h4>
{/pc}
</li>
{/loop}
{/pc}
</ul>
</li>
{/loop}
{/pc}
欢迎光临 Scripts 学盟 (http://www.iscripts.org/) |
Powered by Discuz! X2 |