Heim > php教程 > php手册 > Hauptteil

Ändern Sie den Kommentarstil in phpcms

WBOY
Freigeben: 2016-10-22 00:00:08
Original
1345 Leute haben es durchsucht

Das mit phpcms gelieferte Kommentar-Plug-in ist sehr nützlich! Ich persönlich fand den Stil jedoch sehr hässlich und Baidu konnte keine Lösung finden. Vielleicht war meine Suchmethode falsch, also habe ich selbst einige Nachforschungen angestellt. Es gibt zwei Möglichkeiten, ihn zu ändern

Methode 1:

Verwenden Sie die get-Methode in PHPCMS, um Daten abzurufen

<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}
Nach dem Login kopieren

Methode 2:

Zusätzlich zur Verwendung der get-Methode zum Abrufen von Daten gibt es auch die einfachste Möglichkeit, /phpcms/templates/default/comment/show_list.html zu finden, den folgenden Code zu finden und den Stil zu ändern

<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}
Nach dem Login kopieren

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!