PHP学习:修改phpcms中的评论样式
掌握好每一个知识点,考在编写代码的时候就不会有那么多错误了。下面是小编精心为大家整理的修改phpcms中的评论样式,希望对大家学习PHP有帮助,更多内容请关注应届毕业生网!
phpcms中自带的评论插件很好用!但是样式个人感觉丑的狠,百度一下也没能找到解决方式,也许是自己的搜索方式不对,于是自己就研究了研究,这里可以使用两种方法进行修改
方法一:
使用PHPCMS中的`get方法进行获取数据
12345678910111213141516171819//拼接评论表的commentid字段值
php
$commentid
=
'content_'
.
$catid
.
'-'
.
$id
.
'-'
.
$modelid
;
//查询获取数据
pc:getsql=
"SELECT*FROMv9_comment_data_1wherecommentid='$commentid'"
cache=
"0"
return
=
"data"
//循环输出
loop
$data
$key
$val
<li
class
=
"list-group-item"
>
<p
class
=
"media"
>
<a
class
=
"media-left"
href=
"#"
>
<imgsrc=
"IMG_PATHtou.png"
class
=
"img-circle"
alt=
"..."
>
</a>
<p
class
=
"media-body"
>
<h5
class
=
"media-heading"
>
$val
[username]</h5>
<spanstyle=
"font-size:10px;"
>
$val
[content]</span>
</p>
</p>
</li>
/loop
/pc
方法二:
除了使用get方法进行获取数据之外还有一种最简单的方式,找到 /phpcms/templates/default/comment/show_list.html 找到如下代码,进行样式的修改即可
1234567891011121314151617181920pc:commentaction=
"lists"
commentid=
"$commentid"
siteid=
"$siteid"
page=
"$_GET[page]"
hot=
"$hot"
num=
"20"
if
!
empty
$data
<p
class
=
"comment_button"
><ahref=
"APP_PATHindex.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><ahref=
"APP_PATHindex.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></p>
<p
class
=
"comment"
>
loop
$data
$r
<h5
class
=
"titlefn"
>direction
$r
[direction]<fontcolor=
"#FF0000"
>format::
date
$r
[creat_at],1</font>
if
$r
[userid]get_nickname
$r
[userid]
else
$r
[username]/
if
</h5>
<p
class
=
"content"
>
$r
[content]
<p
class
=
"rt"
><ahref=
"javascript:void0"
onclick=
"reply$r[id],'$commentid'"
>回复</a><ahref=
"javascript:void0"
onclick=
"support$r[id],'$commentid'"
>支持</a>(<fontid=
"support_$r[id]"
>
$r
[support]</font>)
</p>
<pid=
"reply_$r[id]"
style=
"display:none"
></p>
</p>
<p
class
=
"bk30hrmb8"
></p>
/loop
</p>
<pid=
"pages"
class
=
"text-r"
>
$pages
</p>
/
if
/pc