KesionCMS-SQL标签打造竖向栏目导航显示菜单
来自站长百科
导航:返回上一页
KesionCMS-SQL标签打造竖向栏目导航显示菜单
栏目导航要这样的(希望出一个竖向栏目导航,可自动识别所属顶级栏目)
这种导航也比较常用到,借此机会,顺便说一下如何做这种效果
首先,是分两个SQL标签去实现的,一个是内层的(调用二级栏目),一个是外层的(调用一级栏目),
- 先建一个内层的SQL标签:
定义名称为"栏目内循环"
- 查询语句:
select top 50 id,foldername from ks_class where tn='{$Param(0)}' order by folderorder
- 循环体:
[loop=20]
[/loop] 根据网站需要,控制[loop=多少] 再看外层sql标签:
- 如定义名称为:外栏目
- 查询语句:
select top 50 id,foldername from ks_class where tj=1 and topflag=1 and channelid=5 order by folderorder 备注:channelid=5 是指调用商城系统下的
- 循环体:
<style> .n li{height:25px;border:1px solid #DDE3FB} .n ul{margin:0px;padding:0px} </style> [loop=50] <div style="background:#DDE3FB;height: 25px;line-height:25px"><strong><a href="{$Field(id,GetInfoUrl,100,1)}"> {$Field(foldername,Text,0,...,0,)} </a></strong></div> <div class="n"> <ul> {SQL_栏目内循环({$Field(id,GetInfoUrl,100,2)})} </ul> </div> [/loop]
好了,接下来把这个标签{SQL_外栏目()}插入到模板中要显示这个效果的位置保存模板.