首先在module.php中添加以下函数
4 {; J7 a6 m9 O& ~" O- <?php
5 x4 A i$ b- e0 x' ?/ | - //comment:输出评论人等级
# b9 b8 f4 j! p2 u5 u& t: T - function echo_levels($comment_author_email,$comment_author_url){
3 u1 Q0 j- N) ?; L! e' g - $DB = MySql::getInstance(); X. k3 Q, H3 @! u+ h
- $adminEmail = '"sheli@shuyong.net"';. W% [* f' \" l2 z. g" d
- if($comment_author_email==$adminEmail). a# y* \: T# o4 s ]
- {
2 N4 q1 e6 N; E, }2 s - echo '<sy id="ys">(管理员)</sy>';
$ R( r' o; o. } - }
1 e, W, n" K* p6 F: R. P( B - $sql = "SELECT cid as author_count,mail FROM emlog_comment WHERE mail != '' and mail = $comment_author_email and hide ='n'";
& J( S& c$ X4 |) U+ t- S3 s( d3 ] - $res = $DB->query($sql);& b0 ~2 e. O1 N. ~
- $author_count = mysql_num_rows($res);3 x& ]. D; V( n9 d- {$ U$ l+ y; o
- if($author_count>=0 && $author_count<5 && $comment_author_email!=$adminEmail)3 V7 l2 F' D+ L5 d$ Z% _; c" Z
- echo '<sy id="ya">(打酱油的)</sy>';
( R- h$ ?9 d9 O( i/ m - else if($author_count>=5 && $author_count<10 && $comment_author_email!=$adminEmail)4 K4 S/ _0 M! m+ M% G" C& T [
- echo '<sy id="yb">(匆匆过客)</sy>';
4 X5 \0 {& a* K - else if($author_count>=10 && $author_count<20 && $comment_author_email!=$adminEmail)6 ^- l* Y% e/ O0 Z9 g; H* ~
- echo '<sy id="yc">(新生入住)</sy>';3 Y: _: B' @# a5 a! S0 _$ x
- else if($author_count>=20 && $author_count<30 && $comment_author_email!=$adminEmail)
: ?7 p. e( D1 d) N! I# D' s - echo '<sy id="yd">(常住住户)</sy>';
$ z/ Z% c- W0 G - else if($author_count>=30 &&$author_count<40 && $comment_author_email!=$adminEmail)
9 O6 {- }0 H" }3 [2 S - echo '活跃住户';. O- z' h, q3 A7 t* \' G
- else if($author_count>=40 && $author_coun<50 && $comment_author_email!=$adminEmail)
% j% T: ]4 X: P2 F% q# c, ` - echo '积极住户';8 u- H1 `8 E% s2 X
- else if($author_count>=50 && $author_coun<60 && $comment_author_email!=$adminEmail)
7 [; l5 Q3 J, S% m' r# ~6 V - echo '五好住户';
* [ o3 ?. J2 D- q* e3 m - else if($author_count>=60 && $author_coun<70 && $comment_author_email!=$adminEmail)
# z8 A# J/ k3 @9 d) E: S - echo '十佳住户';7 F/ @$ R1 X6 e$ S+ {" G7 Z3 U3 H
- else if($author_count>=70 && $author_coun<80 && $comment_author_email!=$adminEmail)
9 m) q6 N+ S9 Y5 p1 q7 [# T, A - echo '住户委员';6 I% {6 ]- m; d3 Y/ s
- else if($author_count>=100 && $comment_author_email!=$adminEmail)2 |8 J( z- ?% v& i: x4 A/ C
- echo '住户代表';
$ H9 k: L7 y ?# H9 K - }
0 z! D, a* T! d1 b - ?>
复制代码 a3 v2 j: C9 U% T$ y1 t
以上代码用于判断评论人所填写的e-mail统计次数,达到相应次数后输出不同的等级,所以在评论中只人e-mail不认名称。 其中上面的<sy id="y*">是给输出等级添加相应的CSS,一般是文字颜色,可直接写在CSS文件中。 调用代码:- - a' j" \) f8 D& m
- <?php $mail_str=""".strip_tags($comment['mail'])."";echo_levels($mail_str,""".$comment['url']."""); ?>
复制代码 在需要调用的地方插入以上代码即可 J! a1 q( ~5 q! b9 f; [- {
|