KesionCMS 帮助
帮助首页 模板标签管理 - 问题汇总

9、SQL标签打造竖向栏目导航显示菜单

0 2009/8/4 16:05:10

引用网友的话:

 

 

栏目导航我要这样的(希望出一个竖向栏目导航,可自动识别所属顶级栏目)

图片点击可在新窗口打开查看

 

上午在论坛看到网友需要这种效果,这种导航也比较常用到,借此机会,顺便说一下如何做这种效果,希望对大家有所帮助...

 

首先,我是分两个SQL标签去实现的,一个是内层的(调用二级栏目),一个是外层的(调用一级栏目),

 

先建一个内层的SQL标签:

 

定义名称为"栏目内循环"

 

查询语句:select top 50 id,foldername from ks_class where tn='{$Param(0)}' order by folderorder

 

循环体:

 

[loop=20]
<li><a href="{$Field(id,GetInfoUrl,100,1)}">{$Field(foldername,Text,0,...,0,)}</a></li>
[/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_外栏目()}插入到模板中要显示这个效果的位置保存模板.

100%