标题:科汛CMS的sql标签使用技巧
作者:网友
日期:2020-02-17 16:16:59
内容:

关键字描述:使用技巧 标签   Field < 求职 where from 科技

1、sql标签实现栏目后带栏目下文章数:

 示例效果:

科技(100) 求职(2000) 教育(10) 科技(100) 求职(2000) 教育(10)

实现要点:

SQL语句
SELECT top 10 id, foldername,(select count(*) from ks_article where tid=ks_class.id and verific=1) as sum from ks_class where channelid=1

循环体
[loop=10]
<a href='{$Field(id,GetInfoUrl,100,1)}'>
{$Field(foldername,Text,0,...,0,)}({$Field(ssum,Num,0,2)}篇)
</a>
[/loop]

2、专题专题名称后带文章(数量)

示例效果:

科技(100) 求职(2000) 教育(10) 科技(100) 求职(2000) 教育(10)

实现要点:
语句
SELECT top 10 specialid, specialname,(select count(*) from ks_article where instr(SpecialID,ks_special.specialid)>0) as ssum from ks_special where channelid=1

循环体
[loop=10]
<a href="/article/special.asp?id={$Field(specialid,Num,0,2)}">
{$Field(specialname,Text,0,...,0,)}({$Field(ssum,Num,0,2)})</a><br>
[/loop]



返回列表 网站首页