phpcms와 함께 제공되는 댓글 플러그인은 매우 유용합니다! 그런데 개인적으로 스타일이 너무 못생겼다고 느꼈고, 바이두에서 해결 방법을 찾지 못한 것 같아 제가 직접 검색을 해본 결과 두 가지 방법으로 수정이 가능합니다.
방법 1:
데이터를 얻으려면 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}
방법 2:
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}