Home  >  Article  >  Backend Development  >  Comment style modification method in phpcms_php example

Comment style modification method in phpcms_php example

WBOY
WBOYOriginal
2016-12-05 13:28:16940browse

The comment plug-in that comes with phpcms is very useful! However, I personally felt that the style was very ugly, and Baidu couldn’t find a solution. Maybe my search method was wrong, so I did some research on it myself. There are two ways to modify it

Method 1:

Use the get method in PHPCMS to obtain data

//拼接评论表的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}

Method 2:

In addition to using the get method to obtain data, there is also the simplest way. Find /phpcms/templates/default/comment/show_list.html and find the following code and modify the style

{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&#63;m=comment&c=index&a=init&commentid={$commentid}&title={urlencode(($comment[title] &#63; $comment[title] : $title))}&url={urlencode(($comment[url] &#63; $comment[url] : $url))}&hot=0&iframe=1"{if empty($hot)} class="on"{/if}>最新</a> <a href="{APP_PATH}index.php&#63;m=comment&c=index&a=init&commentid={$commentid}&title={urlencode(($comment[title] &#63; $comment[title] : $title))}&url={urlencode(($comment[url] &#63; $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}

The above is the method of modifying the comment style in phpcms introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for your support of the Script House website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn