侧边栏最新评论按评论数最多输出文章标题,以下按默认板子为例:将模版module.php中的- <?php8 I& c r/ J9 S7 p
- //widget:最新评论
3 \" m3 ~" P+ J( ?) D+ ~ - function widget_newcomm($title){1 J, G6 v4 C/ i* c3 j
- global $CACHE;
+ Q- c$ r$ H" f - $com_cache = $CACHE->readCache('comment');
" d9 t, F2 p, s: Y) w) O - ?>9 l+ l/ \( ~- B e2 S1 Z1 q( T* s- T/ `
- <li>6 S3 t' G8 z0 U) N
- <h3><span><?php echo $title; ?></span></h3>+ E- I9 e6 [+ u# B0 X, L
- <ul id="newcomment">
2 p" w# \& V: E2 X; ^1 k4 X! i ] - <?php
+ l( W" f/ z& y. ]3 W$ l - foreach($com_cache as $value):' q$ v" o0 S' A! @) Q
- $url = Url::comment($value['gid'], $value['page'], $value['cid']);
6 Y* L0 E7 z! ` ^$ i" G) h% R - ?>7 _+ O2 \& f+ A T8 M6 e6 A. h& y
- <li id="comment"><?php echo $value['name']; ?>& F6 }' @ [0 _1 z$ P- q2 @9 g% C4 G
- <br /><a href="<?php echo $url; ?>"><?php echo $value['content']; ?></a></li>
7 ?0 M4 a2 X1 G% I - <?php endforeach; ?>" ~% p& e7 D7 ^ S4 I1 C% ?0 f6 X
- </ul>8 I( {, h/ T: t) D l0 z& {! b# p
- </li>
|/ Z) X- N( }4 ] - <?php }?>
复制代码 替换成- <?php //widget:热评文章0 _, ~6 J* g8 b) W [
- function widget_newcomm($title){$index_comnum = Option::get('index_comnum');?>
! s1 S8 [0 ?/ A3 s" P- F c5 ~ - <li>
# |$ e/ Z" P; t @% ~+ o0 l - <h3><span><?php echo $title;?></span></h3>
3 S3 c' `7 v- M$ t1 H$ j9 k - <ul id="newcomment">9 h+ ], v% A- E( Q# b( g
- <?php $db = MySql::getInstance();$db = MySql::getInstance();
# W. T5 A+ Q+ e- f - $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");( J% Y; u% n0 l% j" M7 _+ S+ ^
- while($row = $db->fetch_array($sql)){?>( d' K: P$ l3 @. t2 Q* Y* j
- <li id="comment"><a href="<?php echo Url::log($row['gid']);?>" title="<?php echo $row['title'];?>" /><?php echo $row['title'];?></a></li>, V( a* Z8 k' W. i$ V7 Z
- <?php }?></ul><?php }?>
复制代码 这样就搞定收工了!本文有舍力原创,转载请注明,谢谢合作!
6 Z6 y) c$ m+ ~ |