首先在module.php中添加以下函数
- y4 f O- A# n( b- <?php
3 I# N$ M/ O0 `/ Z2 }* P - //comment:输出评论人等级0 b! i/ H+ N# h) H
- function echo_levels($comment_author_email,$comment_author_url){
- d3 ]$ O5 N# ^0 }8 }6 F a& S" q) q" h: s - $DB = MySql::getInstance();
3 R- {& B2 |2 N5 O- p - $adminEmail = '"sheli@shuyong.net"';3 A0 v5 J# m% T
- if($comment_author_email==$adminEmail)8 O4 F" m2 k/ {
- {+ a$ d# Q' v2 I
- echo '<sy id="ys">(管理员)</sy>';/ E# {$ r; o! Q5 c+ |
- }
A9 R, P Y2 h - $sql = "SELECT cid as author_count,mail FROM emlog_comment WHERE mail != '' and mail = $comment_author_email and hide ='n'";( A, m* E) m# W( \
- $res = $DB->query($sql);- m! |5 j6 o& ?. D% K
- $author_count = mysql_num_rows($res);6 b% [3 A- h" \) X8 Y1 Y
- if($author_count>=0 && $author_count<5 && $comment_author_email!=$adminEmail) S0 R* T. b: p, N' v B9 ^
- echo '<sy id="ya">(打酱油的)</sy>';
" v: e' H7 E# m; P8 T - else if($author_count>=5 && $author_count<10 && $comment_author_email!=$adminEmail)% W9 k" D' Q" l
- echo '<sy id="yb">(匆匆过客)</sy>';; e' s8 w7 r+ ~# i
- else if($author_count>=10 && $author_count<20 && $comment_author_email!=$adminEmail)
5 x# I* Z3 r# s6 F2 Q3 @7 B - echo '<sy id="yc">(新生入住)</sy>';0 k2 {+ b/ z6 ~7 s
- else if($author_count>=20 && $author_count<30 && $comment_author_email!=$adminEmail), U- x+ y2 y2 Z. s- g x
- echo '<sy id="yd">(常住住户)</sy>';+ ]3 r' `+ ~# Z. a9 g
- else if($author_count>=30 &&$author_count<40 && $comment_author_email!=$adminEmail)8 M* O( W6 w2 }" X
- echo '活跃住户';
) N2 k2 m P& N [! N) e$ o - else if($author_count>=40 && $author_coun<50 && $comment_author_email!=$adminEmail)
j, ]$ [7 M6 u5 O; n" ~ G3 b - echo '积极住户';( k+ w' x6 u9 ~1 i# L+ n6 k
- else if($author_count>=50 && $author_coun<60 && $comment_author_email!=$adminEmail)# C, B$ W- T' G, c5 Q0 O8 j) ^
- echo '五好住户';
( ~, ^ L$ Y0 s; p2 Z+ A+ v ^ - else if($author_count>=60 && $author_coun<70 && $comment_author_email!=$adminEmail)# n0 k: z% b" A4 g2 J5 ]" ]( @' G
- echo '十佳住户';$ U+ R. f4 { ~% ~- H7 G; m' V# Q
- else if($author_count>=70 && $author_coun<80 && $comment_author_email!=$adminEmail)$ I* U2 G* }8 Y
- echo '住户委员';% a; @1 u; T8 j# M$ t& n
- else if($author_count>=100 && $comment_author_email!=$adminEmail)
# v3 L( p% o9 |- W! r& q) J - echo '住户代表';
% z% Y; }5 z" L' K5 M$ z4 O - }
t9 L' _0 m, \8 W4 ~ - ?>
复制代码
/ s( z# k8 F+ b/ k以上代码用于判断评论人所填写的e-mail统计次数,达到相应次数后输出不同的等级,所以在评论中只人e-mail不认名称。
其中上面的<sy id="y*">是给输出等级添加相应的CSS,一般是文字颜色,可直接写在CSS文件中。 调用代码:
2 K( K m& [6 q- <?php $mail_str=""".strip_TAGs($comment['mail'])."";echo_levels($mail_str,""".$comment['url']."""); ?>
复制代码 在需要调用的地方插入以上代码即可2 }+ A7 t( f& R
|