帝国cms自定义专题列表模板list.var中获取对应专题下的信息、信息数量及信息所属栏目名称
代码如下:
$rr = $empire->fetch1("SELECT GROUP_CONCAT(id) from phome_enewsztinfo where ztid='$r[id]'");
$ff = $rr[0];
$ga = explode(",", $ff);
for ($i = 0; $i < 6; $i++) {
if ($ga[$i]) {
$cc = $empire->fetch1("select * from phome_ecms_app where id='$ga[$i]'");
// 查询phome_enewsclass表
$classInfo = $empire->fetch1("select * from phome_enewsclass where classid='$cc[classid]'");
$classname = $classInfo['classname'];
$nr .= '<li><a href="'.$cc[titleurl].'" target="_blank"><img src="'.$cc[titlepic].'" alt="'.$cc[title].'" /><p>'.$cc[title].'</p><span>'.$classname.'</span></a></li>';
}
}
$num = $empire->gettotal("select count(*) as total from phome_enewsztinfo where ztid='$r[id]'");
$listtemp = '<li>
<a href="/[!--titleurl--]/" target="_blank"><img src="[!--titlepic--]" alt="[!--title--]"/></a>
<div class="info">
<a href="/[!--titleurl--]/" target="_blank"><p class="name">[!--title--]</p><span>更新:[!--newstime--]</span></a>
<ul>
'.$nr.'
</ul>
</div>
<em><i class="ico"></i><a href="/[!--titleurl--]/" target="_blank">'.$num.'</a>款</em>
<div class="line"></div>
</li>';