亚洲青青视频一区|8MAV在线观看|天天看AV天天看|中日成人手机在线|欧美激情五区六区|亚洲婷婷天堂级片|亚洲天堂网7777|欧美日韩其他另类|手机在线成人AV|成人性大片一区二区三区四区五区

284292114@qq.com 中國站
新聞中心 網(wǎng)絡(luò)推廣 網(wǎng)站建設(shè) 優(yōu)化推廣 首頁>新聞中心>優(yōu)化推廣>建網(wǎng)站

PBOOCMS如何制作文章評(píng)論。

時(shí)間:2019-08-23   訪問量:0

手先聲明一下,今天是2019年8月23日,PB目前暫時(shí)無會(huì)員,所以就沒有文章評(píng)論功能。


但是官方已經(jīng)確認(rèn)下個(gè)月發(fā)布會(huì)員功能,到時(shí)候應(yīng)該有文章評(píng)論功能了。


請(qǐng)看本博客下面的留言功能。由于開啟了緩存機(jī)制,所以留言后,大概15分鐘才會(huì)更新出來。


另外需要注意的是,如果不是默認(rèn)的確表單,就使用:form標(biāo)簽,而不是:message標(biāo)簽了。這個(gè)很重要。


本文只是介紹在目前狀態(tài)下,使用留言功能制作評(píng)論功能。不喜匆噴。


弟一步:后臺(tái)給留言表單添加一個(gè)自定義字段,比如說:contentid


第二步:前端樣式我就不說了。就拿官方模板作演示。直接復(fù)制官方留言文件中的代碼。然后作如下的修改。

	{pboot:if({page:rows}>0)}
    	<h5 class="border-bottom border-info pb-2"><i class="fa fa-sliders" aria-hidden="true"></i> 留言記錄</h5>
	{/pboot:if}
	 
	<!-- 留言記錄 -->
    {pboot:message num=2}
    
        {pboot:if('[message:contentid]'=='{content:id}')}<!-- 增加 -->
    <div class="media border-bottom pb-3 pt-3">
	  <img class="mr-3" src="{pboot:sitetplpath}/images/user.png" height="25">
	  <div class="media-body">
	    <h5 class="mt-0">[message:contacts]:</h5>
	    <p>[message:content]</p>
	    <p>
	    	<span class="badge badge-light text-secondary font-weight-normal">[message:mobile substr=1,3]****[message:mobile substr=8]</span>
	    	<span class="badge badge-light text-secondary font-weight-normal">[message:os]</span>
	    	<span class="badge badge-light text-secondary font-weight-normal">[message:bs]</span>
	    	<span class="badge badge-light text-secondary font-weight-normal">[message:askdate]</span>
	    </p>
	    <div class="media mt-3 border-top-dashed pt-3">
	      <img class="mr-3" src="{pboot:sitetplpath}/images/user.png" height="25">
	      <div class="media-body">
	        <h5 class="mt-0">管理員回復(fù):</h5>
	        <p>[message:recontent]</p>
	        <p><span class="badge badge-light text-secondary font-weight-normal">[message:replydate]</span></p>
	      </div>
	    </div>
	  </div>
	</div>
	{/pboot:if}<!-- 增加 -->
	{/pboot:message}
	
	<!-- 分頁 -->
 	{pboot:if({page:rows}>0)}
	<nav aria-label="page navigation" class="my-4">
      <div class="pagination justify-content-center">
      	<a class="page-item page-link" href="{page:index}">手頁</a>
        <a class="page-item page-link" href="{page:pre}">上一頁</a>
        {page:numbar}<!-- 數(shù)字條,小屏幕時(shí)自動(dòng)隱藏-->
        <a class="page-item page-link" href="{page:next}">下一頁</a>
        <a class="page-item page-link" href="{page:last}">尾頁</a>
      </div>
    </nav>
    {/pboot:if}
    
	
	
    <!-- 留言表單 -->
    <div class="row">
    	<div class="col-lg-3"></div>
    	<div class="col-12 col-lg-6">
        	<form class="my-4" onsubmit="return submsg(this);">
                <div class="form-group">
                    <label for="contacts">聯(lián)系人</label>
                    <div>
                        <input type="text" name="contacts" required id="contacts" class="form-control" placeholder="請(qǐng)輸入聯(lián)系人">
                    </div>
                </div>
                
                <div class="form-group">
                    <label for="mobile">手 機(jī)</label>
                    <div>
                        <input type="text" name="mobile" required id="mobile" class="form-control" placeholder="請(qǐng)輸入聯(lián)系人手機(jī)">
                    </div>
                </div>
                
                <div class="form-group">
                    <label for="content" >內(nèi) 容</label>
                    <div>
                        <textarea name="content" id="content" class="form-control" placeholder="請(qǐng)輸入留言內(nèi)容"></textarea>
                    </div>
                </div>
              
                  <!-----------新增-------------> 
                 <div class="form-group">
               
                    <div>
                        <input type="hidden" name="contentid" required id="contentid" class="form-control" placeholder="{content:id}" value="{content:id}">
                    </div>
                </div>
                
                {if([$config.message_check_code])}
                <div class="form-group">
                    <label for="checkcode">驗(yàn)證碼</label>
                    <div class="row">
                        <div class="col-6">
                            <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="請(qǐng)輸入驗(yàn)證碼">
                        </div>
                        <div class="col-6">
                            <img title="點(diǎn)擊刷新" style="height:33px;" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
                        </div>
                    </div>
                </div>
                {/if}
                
                <div class="form-group">
                   <button type="submit" class="btn btn-info mb-2">提交留言</button>
                </div>
            </form>
        </div>
        <div class="col-lg-3"></div>
    </div> 

</div>


<script>

//ajax提交留言
function submsg(obj){
  var url='{pboot:msgaction}';
  var contacts=$(obj).find("#contacts").val();
  var mobile=$(obj).find("#mobile").val();
  var content=$(obj).find("#content").val();
  var checkcode=$(obj).find("#checkcode").val();
  var contentid=$(obj).find("#contentid").val();  //新增
  $.ajax({
    type: 'POST',
    url: url,
    dataType: 'json',
    data: {
    	contacts: contacts,
    	mobile: mobile,
    	content: content,
    	checkcode: checkcode,
    	  contentid: contentid    //新增
    },
    success: function (response, status) {
      if(response.code){
		 alert("謝謝您的反饋,我們會(huì)盡快聯(lián)系您!");
		 $(obj)[0].reset(); 
      }else{
    	 alert(response.data);
      }
    },
    error:function(xhr,status,error){
      alert('返回?cái)?shù)據(jù)異常!');
    }
  });
  return false;
}
</script>


服務(wù)咨詢
1對(duì)1咨詢,專業(yè)客服為您解疑答惑
聯(lián)系銷售
15899750475
在線咨詢
聯(lián)系在線客服,為您解答所有的疑問
ARE YOU INTERESTED IN ?
感興趣嗎?

有關(guān)我們服務(wù)的更多信息,請(qǐng)聯(lián)系項(xiàng)目經(jīng)理

15899750475 楊先生