网(LieHuo.Net)教程 PHPCMS Get调用三级栏目列表的方法,在论坛上搜了半天,找到这些代码:
以下为引用的内容: <!--{get sql="SELECT parentid, url, catname, arrchildid,child FROM `phpcms_category` WHERE `parentid` = 11 and `child` = 1 " return="r1"}--> <a href="{$r1[url]}" title="{$r1[catname]}" ><h1>{$r1[catname]}</h1></a> <!-- 二级栏目名称及链接 --> <ul> <!--{get sql="SELECT url, catname FROM `phpcms_category` WHERE `catid` IN ($r1[child] = 0 AND $r1[arrchildid])" return="r2"}--> <li><a href="{$r2[url]}" target="_blank"> {$r2[catname]}</a></li> <!-- **栏目名称及链接 --> <!--{/get}--> </ul> <!--{/get}--> 可我觉得这样写,要到把栏目ID写死在模版里。尝试这样写,为什么实现不了呢? <? $flmid=$CATEGORY[$catid][parentid]?> {get sql="SELECT parentid, url, catname, arrchildid,child,catid FROM `phpcms_category` WHERE `arrchildid` =$flmid and `child` = 1 " return="r1"} { get sql="SELECT url, catname, catid FROM `phpcms_category` WHERE `catid` IN ($r1[child] = 0 AND $r1[arrchildid])" return="r2"} <li><a href="{$r2[url]}" {if $catid == $r2[catid]} class="current" {/if}> {$r2[catname]}</a> </li> {/get} {/get} |