首页 > php教程 > php手册 > 修改phpcms中的评论样式

修改phpcms中的评论样式

WBOY
发布: 2016-10-22 00:00:08
原创
1368 人浏览过

phpcms中自带的评论插件很好用!但是样式个人感觉丑的狠,百度一下也没能找到解决方式,也许是自己的搜索方式不对,于是自己就研究了研究,这里可以使用两种方法进行修改

方法一:

使用PHPCMS中的get方法进行获取数据

<span style="color: #008080;"> 1</span> <span style="color: #000000;">//拼接评论表的commentid字段值
</span><span style="color: #008080;"> 2</span> <span style="color: #000000;">{php $commentid = 'content_'.$catid.'-'.$id.'-'.$modelid;}
</span><span style="color: #008080;"> 3</span> <span style="color: #000000;">//查询获取数据
</span><span style="color: #008080;"> 4</span> <span style="color: #000000;">         {pc:get sql="SELECT * FROM v9_comment_data_1 where commentid = '$commentid'" cache="0" return="data"}
</span><span style="color: #008080;"> 5</span> <span style="color: #000000;">//循环输出
</span><span style="color: #008080;"> 6</span> <span style="color: #000000;">          {loop $data $key $val}
</span><span style="color: #008080;"> 7</span>           <span style="color: #0000ff;"><span style="color: #800000;">li </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="list-group-item"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;"> 8</span>             <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="media"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;"> 9</span>               <span style="color: #0000ff;"><span style="color: #800000;">a </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="media-left"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="#"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">10</span>                 <span style="color: #0000ff;"><span style="color: #800000;">img </span><span style="color: #ff0000;">src</span><span style="color: #0000ff;">="{IMG_PATH}tou.png"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="img-circle"</span><span style="color: #ff0000;"> alt</span><span style="color: #0000ff;">="..."</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">11</span>               <span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">12</span>               <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="media-body"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">13</span>                  <span style="color: #0000ff;"><span style="color: #800000;">h5 </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="media-heading"</span><span style="color: #0000ff;">></span>{$val[username]}<span style="color: #0000ff;"></span><span style="color: #800000;">h5</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">14</span>                 <span style="color: #0000ff;"><span style="color: #800000;">span </span><span style="color: #ff0000;">style</span><span style="color: #0000ff;">="font-size:10px;"</span><span style="color: #0000ff;">></span>{$val[content]}<span style="color: #0000ff;"></span><span style="color: #800000;">span</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">15</span>               <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">16</span>             <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">17</span>           <span style="color: #0000ff;"></span><span style="color: #800000;">li</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">18</span> <span style="color: #000000;">           {/loop}
</span><span style="color: #008080;">19</span>          {/pc}</span></span></span></span></span></span></span>
登录后复制

方法二:

除了使用get方法进行获取数据之外还有一种最简单的方式,找到 /phpcms/templates/default/comment/show_list.html 找到如下代码,进行样式的修改即可

<span style="color: #008080;"> 1</span> <span style="color: #000000;">{pc:comment action="lists" commentid="$commentid" siteid="$siteid" page="$_GET[page]" hot="$hot" num="20"}
</span><span style="color: #008080;"> 2</span> <span style="color: #000000;">{if !empty($data)}      
</span><span style="color: #008080;"> 3</span> <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="comment_button"</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="{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"</span><span style="color: #ff0000;">{if empty($hot)} class</span><span style="color: #0000ff;">="on"</span><span style="color: #ff0000;">{/if}</span><span style="color: #0000ff;">></span>最新<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span> <span style="color: #0000ff;"><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="{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"</span><span style="color: #ff0000;">{if $hot} class</span><span style="color: #0000ff;">="on"</span><span style="color: #ff0000;">{/if}</span><span style="color: #0000ff;">></span>最热<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;"> 4</span>     
<span style="color: #008080;"> 5</span> <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="comment"</span><span style="color: #0000ff;">></span>
<span style="color: #008080;"> 6</span> <span style="color: #000000;">{loop $data $r}
</span><span style="color: #008080;"> 7</span>     <span style="color: #0000ff;"><span style="color: #800000;">h5 </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="title fn"</span><span style="color: #0000ff;">></span>{direction($r[direction])} <span style="color: #0000ff;"><span style="color: #800000;">font </span><span style="color: #ff0000;">color</span><span style="color: #0000ff;">="#FF0000"</span><span style="color: #0000ff;">></span>{format::date($r[creat_at], 1)}<span style="color: #0000ff;"></span><span style="color: #800000;">font</span><span style="color: #0000ff;">></span> {if $r[userid]}{get_nickname($r[userid])}{else}{$r[username]}{/if} <span style="color: #0000ff;"></span><span style="color: #800000;">h5</span><span style="color: #0000ff;">></span>
<span style="color: #008080;"> 8</span>     <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="content"</span><span style="color: #0000ff;">></span><span style="color: #000000;">{$r[content]}
</span><span style="color: #008080;"> 9</span>     <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="rt"</span><span style="color: #0000ff;">><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="javascript:void(0)"</span><span style="color: #ff0000;"> onclick</span><span style="color: #0000ff;">="reply({$r[id]}, '{$commentid}')"</span><span style="color: #0000ff;">></span>回复<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span>  <span style="color: #0000ff;"><span style="color: #800000;">a </span><span style="color: #ff0000;">href</span><span style="color: #0000ff;">="javascript:void(0)"</span><span style="color: #ff0000;"> onclick</span><span style="color: #0000ff;">="support({$r[id]}, '{$commentid}')"</span><span style="color: #0000ff;">></span>支持<span style="color: #0000ff;"></span><span style="color: #800000;">a</span><span style="color: #0000ff;">></span>(<span style="color: #0000ff;"><span style="color: #800000;">font </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="support_{$r[id]}"</span><span style="color: #0000ff;">></span>{$r[support]}<span style="color: #0000ff;"></span><span style="color: #800000;">font</span><span style="color: #0000ff;">></span><span style="color: #000000;">)
</span><span style="color: #008080;">10</span>     <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">11</span>     <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="reply_{$r[id]}"</span><span style="color: #ff0000;"> style</span><span style="color: #0000ff;">="display:none"</span><span style="color: #0000ff;">></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">12</span>     <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">13</span>     
<span style="color: #008080;">14</span>   <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="bk30 hr mb8"</span><span style="color: #0000ff;">></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">15</span> <span style="color: #000000;">  {/loop}
</span><span style="color: #008080;">16</span> <span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">17</span> 
<span style="color: #008080;">18</span>  <span style="color: #0000ff;"><span style="color: #800000;">div </span><span style="color: #ff0000;">id</span><span style="color: #0000ff;">="pages"</span><span style="color: #ff0000;"> class</span><span style="color: #0000ff;">="text-r"</span><span style="color: #0000ff;">></span>{$pages}<span style="color: #0000ff;"></span><span style="color: #800000;">div</span><span style="color: #0000ff;">></span>
<span style="color: #008080;">19</span> <span style="color: #000000;"> {/if}
</span><span style="color: #008080;">20</span>  {/pc}</span></span></span></span></span></span></span></span></span></span></span></span></span></span>
登录后复制

 

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板