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

侧边栏最新评论按评论数最多输出文章标题,以下按默认板子为例:将模版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; ?>"><?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']);?>" title="<?php echo $row['title'];?>" /><?php echo $row['title'];?></a></li>
<?php }?></ul><?php }?>

这样就搞定收工了!

原文地址:https://www.shuyong.net/668.html

CTRL+D快速收藏,欢迎常来喔

本文链接:侧边栏最新评论按评论数最多输出文章标题 - https://f162.cn/post-234.html

相关推荐
发表评论
0 评论
还没有评论,快来抢沙发吧!