> php教程 > php手册 > 본문

phpcms에서 주석 스타일 수정

WBOY
풀어 주다: 2016-10-22 00:00:08
원래의
1347명이 탐색했습니다.

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}
로그인 후 복사

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!