tag直接关联文章副表里面的tag,然后找到文章表对应id,然后调出缩略图
效果:
<?php$sql=$empire->query("select * from {$dbtbpre}enewstags where cid = 1 order by isgood desc limit 15");while($r=$empire->fetch($sql)){$r2=$empire->fetch1("select id from {$dbtbpre}ecms_news_data_1 where infotags like '%".$r['tagname']."%' ORDER BY `{$dbtbpre}ecms_news_data_1`.`id` DESC limit 1");$r3=$empire->fetch1("select titlepic from {$dbtbpre}ecms_news where id = ".$r2['id']." and titlepic != '' ORDER BY `{$dbtbpre}ecms_news`.`newstime` desc limit 1");if($r3['titlepic']==null){$r3['titlepic']= 'http://bz.xiazaii.com../e/data/images/notimg.gif';}?><a href="/tag/<?=$r['tagid']?>.html" target="_blank"><div class="photo-l"><img src="<?=$r3['titlepic']?>"></div><div class="text-r"><p class="tit"><?=$r['tagname']?></p><p class="picnum">图片数:<?=$r['num']?>组</p></div></a><?php}?>
前提是要将tag手动设置好分类。
转载请注明: » 帝国cms调用tag以及tag内文章缩略图的二次开发记录