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><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><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><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><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><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><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><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}
方法二:
除了使用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><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="comment_button"</span><span style="color: #0000ff;">><</span><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><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><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><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><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><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><span style="color: #800000;">div </span><span style="color: #ff0000;">class</span><span style="color: #0000ff;">="rt"</span><span style="color: #0000ff;">><</span><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><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><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><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><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><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}