帝国cms调用标题分类名称并且统计分类下的信息数
帝国cms要实现在模板中调用标题分类可以用标签,但是同时要统计文章信息数,就要用到left join on多条件查询
先说下单条件查询
- select * from product a left join product_details b on a.id = b.id
帝国cms调用所有标题分类的方法,并且统计信息数
- [e:loop={“select count(tname) as number,tname,tpath from( select {$dbtbpre}ecms_news.ttid ttid,{$dbtbpre}enewsinfotype.tname tname,{$dbtbpre}enewsinfotype.tpath tpath from {$dbtbpre}ecms_news left join {$dbtbpre}enewsinfotype on {$dbtbpre}ecms_news.ttid = {$dbtbpre}enewsinfotype.typeid) temp_tnameCount group by tname order by number desc limit 8”,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]
指定新闻模型mid=1下的标题分类,并且按照信息数排序
- [e:loop={“select count(tname) as number,tname,tpath,mid from( select {$dbtbpre}ecms_news.ttid ttid,{$dbtbpre}enewsinfotype.tname tname,{$dbtbpre}enewsinfotype.tpath tpath,{$dbtbpre}enewsinfotype.mid mid from {$dbtbpre}ecms_news left join {$dbtbpre}enewsinfotype on {$dbtbpre}ecms_news.ttid = {$dbtbpre}enewsinfotype.typeid and {$dbtbpre}enewsinfotype.mid=1) temp_tnameCount group by tname order by number desc limit 4”,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]