`$ v) h [# \& a调用最新微语一条代码(直接放入你需要显示的地方即可,其中的0表示从第一条开始,可自行设置从第几天开始)- <?php $newtws_cache = $CACHE->readCache('newtw');echo $newtws_cache[0]['t'];?>
复制代码 & i/ z; \1 H# c/ X5 r/ o
热门评论者排行榜(已经去除管理员,其中的15表示显示数量;30*24*60*60中的30表示30天,使用下面代码时,需要)- <?php
* o/ l2 S6 R. y# E2 V6 r - $db = MySql::getInstance();
2 P" h" m# C. O- \: g l% ] - $url .=BLOG_URL.'';- i/ n. o/ ]( E8 l
- $time = time();" I1 p6 p- W4 r/ P" o3 Q& T
- $sql = "SELECT COUNT(poster) AS p,poster,mail,url FROM ".DB_PREFIX."comment WHERE url!='$url' AND date > $time - 30*24*60*60 AND hide='n' GROUP BY poster ORDER BY p DESC LIMIT 15";
) X# o+ M, J/ S- \ - $count = $db->query($sql);
% N$ N+ B8 S& M, w3 B6 z" v4 Y4 x - while($row = $db->fetch_array($count)){
* @5 W( K. H" z! o. W1 w. {+ C# w D - $g = myGravatar($row['mail']);0 b) ?$ g1 v% t6 } s
- $sycomments .= '<a href="'.$row['url'].'" title="'.$row['poster'].' 发表 '.$row['p'].' 条评论" rel="nofollow" target="_blank"><img width="40" height="40" src="'.$g.'" alt="'.$row['poster'].'发表'.$row['p'].'条评论!" /></a> ';3 {/ c9 M* M" U
- }echo $sycomments; L( H/ o8 S+ \; [6 w
- ?>
复制代码- <?php //获取Gravatar头像,请检查你的module.php是否存在此代码,如存在删除此代码即可
( I, i ]* Z1 A# P1 h - function myGravatar($email, $s = 40, $d = 'mm', $g = 'g') {
9 l& K% P8 t7 F, b5 t - $hash = md5($email);3 D+ w8 c) [7 [' g
- $avatar = "http://cn.gravatar.com/avatar/$hash?s=$s&d=$d&r=$g";+ Q5 X3 x* x8 i. u0 _
- return $avatar;. [' {6 Y6 S: s; k( Y9 [/ R
- }?>
复制代码
9 Y/ l& z D) B+ x所有文章分类代码- <?php $sort_cache = $CACHE->readCache('sort');foreach($sort_cache as $value){?><a href="<?php echo Url::sort($value['sid']); ?>"><?php echo $value['sortname'];?></a><br><?php }?>
复制代码 * O" e! \+ ~+ a! J2 ?
* N5 R/ _$ x ?6 a% T, e% a
|