phpcms中自带的评论插件很好用!但是样式个人感觉丑的狠,百度一下也没能找到解决方式,也许是自己的搜索方式不对,于是自己就研究了研究,这里可以使用两种方法进行修改
方法一:
使用PHPCMS中的get方法进行获取数据
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//拼接评论表的commentid字段值 {php $commentid = 'content_' . $catid . '-' . $id . '-' . $modelid ;} //查询获取数据 {pc:get sql= "SELECT * FROM v9_comment_data_1 where commentid = '$commentid'" cache= "0" return = "data" } //循环输出 {loop $data $key $val } <li class = "list-group-item" > <div class = "media" > <a class = "media-left" href= "#" > <img src= "{IMG_PATH}tou.png" class = "img-circle" alt= "..." > </a> <div class = "media-body" > <h5 class = "media-heading" >{ $val [username]}</h5> <span style= "font-size:10px;" >{ $val [content]}</span> </div> </div> </li> {/loop} {/pc} |
方法二:
除了使用get方法进行获取数据之外还有一种最简单的方式,找到 /phpcms/templates/default/comment/show_list.html 找到如下代码,进行样式的修改即可
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
{pc:comment action= "lists" commentid= "$commentid" siteid= "$siteid" page= "$_GET['page']" hot= "$hot" num= "20" } { if ! empty ( $data )} <div class = "comment_button" ><a href= "{APP_PATH}index.php?m=comment&c=index&a=init&commentid={$commentid}&title={urlencode(($comment[title] ? $comment[title] : $title))}&url={urlencode(($comment[url] ? $comment[url] : $url))}&hot=0&iframe=1" { if empty ( $hot )} class = "on" {/ if }>最新</a> <a href= "{APP_PATH}index.php?m=comment&c=index&a=init&commentid={$commentid}&title={urlencode(($comment[title] ? $comment[title] : $title))}&url={urlencode(($comment[url] ? $comment[url] : $url))}&hot=1&iframe=1" { if $hot } class = "on" {/ if }>最热</a></div> <div class = "comment" > {loop $data $r } <h5 class = "title fn" >{direction( $r [direction])} <font color= "#FF0000" >{format:: date ( $r [creat_at], 1)}</font> { if $r [userid]}{get_nickname( $r [userid])}{ else }{ $r [username]}{/ if } </h5> <div class = "content" >{ $r [content]} <div class = "rt" ><a href= "javascript:void(0)" onclick= "reply({$r[id]}, '{$commentid}')" >回复</a> <a href= "javascript:void(0)" onclick= "support({$r[id]}, '{$commentid}')" >支持</a>(<font id= "support_{$r[id]}" >{ $r [support]}</font>) </div> <div id= "reply_{$r[id]}" style= "display:none" ></div> </div> <div class = "bk30 hr mb8" ></div> {/loop} </div> <div id= "pages" class = "text-r" >{ $pages }</div> {/ if } {/pc} |
以上所述是小编给大家介绍的phpcms中的评论样式修改方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!
原文链接:http://www.cnblogs.com/itsuibi/archive/2016/10/20/5983017.html