方案二:在列表模板调用当前父栏目下所有的作者
- [e:loop={"select count(writer) as number,writer from [!db.pre!]ecms_news temp_tnameCount where writer<>' ' group by writer order by number desc limit 30",10,24,1}]
- <li><a href="[!--news.url--]e/action/ListInfo.php?ph=1&mid=7&tempid=2&writer=<?=$bqr[writer]?>" target="_blank" title="<?=$bqr[writer]?>"><?=$bqr[writer]?><span> (<?=$bqr[number]?>)</span></a></li>
- [/e:loop]
- <?
- $bclassid = $class_r[$GLOBALS[navclassid]][bclassid]; //获取当前父栏目ID
- ?>
- [e:loop={"select count(writer) as number,writer,classid from [!db.pre!]ecms_article temp_tnameCount where writer<>' ' and classid
- in (select classid from [!db.pre!]enewsclass where bclassid ='$bclassid') group by writer order by number desc limit 30",10,24,1}]
- <li><a href="[!--news.url--]e/action/ListInfo.php?ph=1&mid=1&tempid=2&writer=<?=$bqr[writer]?>" target="_blank" title="<?=$bqr[writer]?>"><?=$bqr[writer]?><span> (<?=$bqr[number]?>)</span></a></li>
- [/e:loop]
说明:
①、查询[!db.pre!]ecms_article表中作者不为空的记录,并且以作者writer字段统计数量,按照数量降序排序,调用30条数据。
②、系统模型管理,将writer字段的“结合项”勾选上。
③、[!--news.url--]e/action/ListInfo.php?ph=1&mid=7&tempid=2&writer=<?=$bqr[writer]?>,ph=1为声名要使用结合项,mid=1指定系统模型,tempid=2指定的模板id。