標籤:
phpcms中內建的評論外掛程式很好用!但是樣式個人感覺醜的狠,百度一下也沒能找到解決方式,也許是自己的搜尋方式不對,於是自己就研究了研究,這裡可以使用兩種方法進行修改
方法一:
使用PHPCMS中的get方法進行擷取資料
1 //拼接評論表的commentid欄位值 2 {php $commentid = ‘content_‘.$catid.‘-‘.$id.‘-‘.$modelid;} 3 //查詢擷取資料 4 {pc:get sql="SELECT * FROM v9_comment_data_1 where commentid = ‘$commentid‘" cache="0" return="data"} 5 //迴圈輸出 6 {loop $data $key $val} 7 <li class="list-group-item"> 8 <div class="media"> 9 <a class="media-left" href="#">10 <img src="{IMG_PATH}tou.png" class="img-circle" alt="...">11 </a>12 <div class="media-body">13 <h5 class="media-heading">{$val[username]}</h5>14 <span style="font-size:10px;">{$val[content]}</span>15 </div>16 </div>17 </li>18 {/loop}19 {/pc}
方法二:
除了使用get方法進行擷取資料之外還有一種最簡單的方式,找到 /phpcms/templates/default/comment/show_list.html 找到如下代碼,進行樣式的修改即可
1 {pc:comment action="lists" commentid="$commentid" siteid="$siteid" page="$_GET[page]" hot="$hot" num="20"} 2 {if !empty($data)} 3 <div class="comment_button"><a href="{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"{if empty($hot)} class="on"{/if}>最新</a> <a href="{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"{if $hot} class="on"{/if}>最熱</a></div> 4 5 <div class="comment"> 6 {loop $data $r} 7 <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> 8 <div class="content">{$r[content]} 9 <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>)10 </div>11 <div id="reply_{$r[id]}" style="display:none"></div>12 </div>13 14 <div class="bk30 hr mb8"></div>15 {/loop}16 </div>17 18 <div id="pages" class="text-r">{$pages}</div>19 {/if}20 {/pc}
修改phpcms中的評論樣式