帝国cms灵动标签调用标题分类、统计标题分类文章数的方法

1093人参与 |分类: 程序学习|时间:2022-09-22 16:28:27

方案一,调用全站新闻系统模型的标题分类,并且按照数量高低排名

[e:loop={"select count(tname) as number,tname,tpath from( select [!db.pre!]ecms_news.ttid ttid,[!db.pre!]enewsinfotype.tname tname,[!db.pre!]enewsinfotype.tpath tpath from [!db.pre!]ecms_news left join [!db.pre!]enewsinfotype on [!db.pre!]ecms_news.ttid = [!db.pre!]enewsinfotype.typeid) temp_tnameCount group by tname order by number desc",10,24,1}] 
<li><a href="[!--news.url--]<?=$bqr[tpath]?>" target="_blank" title="<?=$bqr[tname]?>"><?=$bqr[tname]?> <span>(<?=$bqr[number]?>)</span></a></li> [/e:loop] 

方案二,调用当前父栏目下的所有标题分类,并且按照数量高低排名

<? 
$bclassid = $class_r[$GLOBALS[navclassid]][bclassid]; //获取当前父栏目ID 
?> 
[e:loop={"select count(tname) as number,tname,tpath from( select [!db.pre!]ecms_news.ttid ttid, [!db.pre!]ecms_news.classid classid,[!db.pre!]enewsinfotype.tname tname,[!db.pre!]enewsinfotype.tpath tpath from [!db.pre!]ecms_news left join [!db.pre!]enewsinfotype on [!db.pre!]ecms_news.ttid = [!db.pre!]enewsinfotype.typeid and classid in (select classid from [!db.pre!]enewsclass where bclassid ='$bclassid')) temp_tnameCount group by tname order by number desc",10,24,1}] <li><a href="[!--news.url--]<?=$bqr[tpath]?>" target="_blank" title="<?=$bqr[tname]?>"><?=$bqr[tname]?> <span>(<?=$bqr[number]?>)</span></a></li> [/e:loop]