侧边栏最新评论按评论数最多输出文章标题

2015-6-7 / 0 评论 emlog / Mrxn

本文共计 1283 字,感谢您的耐心浏览与评论.

侧边栏最新评论按评论数最多输出文章标题,以下按默认板子为例:将模版module.php中的


<?php
//widget:最新评论
function widget_newcomm($title){
 global $CACHE; 
 $com_cache = $CACHE->readCache('comment');
 ?>
 <li>
 <h3><span><?php echo $title; ?></span></h3>
 <ul id="newcomment">
 <?php
 foreach($com_cache as $value):
 $url = Url::comment($value['gid'], $value['page'], $value['cid']);
 ?>
 <li id="comment"><?php echo $value['name']; ?>
 <br /><a href="<?php echo $url; ?>" rel="external nofollow" ><?php echo $value['content']; ?></a></li>
 <?php endforeach; ?>
 </ul>
 </li>
<?php }?>

替换成



<?php //widget:热评文章
function widget_newcomm($title){$index_comnum = Option::get('index_comnum');?>
<li>
<h3><span><?php echo $title;?></span></h3>
<ul id="newcomment">
<?php $db = MySql::getInstance();$db = MySql::getInstance();
$sql = $db->query ("SELECT * FROM ".DB_PREFIX."blog inner join ".DB_PREFIX."sort WHERE hide='n' AND type='blog' AND top='n' AND sortid=sid order by `comnum` DESC limit 0,$index_comnum");
while($row = $db->fetch_array($sql)){?>
<li id="comment"><a href="<?php echo Url::log($row['gid']);?>" rel="external nofollow"  title="<?php echo $row['title'];?>" /><?php echo $row['title'];?></a></li>
<?php }?></ul><?php }?>

这样就搞定收工了!本文转载自舍力


标签: emlog

转载:转载请注明原文链接 - 侧边栏最新评论按评论数最多输出文章标题


0条回应:“侧边栏最新评论按评论数最多输出文章标题”


发表评论

{view_code_no}