• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦内容页的评论功能怎么使用
    POST TIME:2021-05-23 01:29
    织梦dedecms程序是很强大的,在自定义模型、图集、频道等等都是自己自由的,所以如果能在文章页加上文章的评论更是锦上添花,所以很多人也想了很多的办法添加评论功能,有些人也想过使用自定义表单的方法来添加评论,但是这样就会麻烦,现在给大家讲解的就是使用ajax来添加评论功能。
    在使用自定义表单提交的基础上修改就可以了,查看一下文章页中的评论提交页,action指向的文件是plus/feedback.php这个文件。
    <input type="hidden" name="action" value="send" />
    <input type="hidden" name="comtype" value="comments">
    <input type="hidden" name="username" value="youke">
    <input type="hidden" name="oldurl" value="http://www.521php.com">
    <input type="hidden" name="aid" value="179" />
    <input type="text" name="msg" value="" />
    <input type="hidden" name="isconfirm" value="yes" />
    action为操纵类型,send代表发布评论,comtype为comments时表示是评论,这个username和oldurl为我自己定义的变量,是为了填写评论的内容,oldurl为评论发布成功后跳转的页面。
    验证码:
    <input name="validate" type="text" id="validate" size="10" style="height:18px;width:60px;margin-right:6px;text-transform:uppercase;" class="nb" />
    <img src='http://local.de.com/include/vdimgck.php' width='60' height='24' style="cursor:pointer" onclick="this.src=this.src+'?'" title="点击我更换图片" alt="点击我更换图片" />
    其中,aid是文章的id,在内容页中可以用{dede:field.id/}获得,在头部调用一个js,{dede:global.cfg_cmsurl/}/include/dedeajax2.js,在织梦内容页中加上<dd id=’commetcontent’></dd>这个是放获取的评论内容,添加以下代码到文件的后面:
    <script language='javascript'>
    function LoadCommets(page)
    {
    var taget_obj = document.getElementById('commetcontent');
    var waithtml = "<div style='line-height:50px'><img src='{dede:global.cfg_cmsurl/}/images/loadinglit.gif' />评论加载中...</div>";
    var myajax = new DedeAjax(taget_obj, true, true, '', 'x', waithtml);
    myajax.SendGet2("{dede:global.cfg_phpurl /}/feedback_ajax.php?dopost=getlist&aid={dede:field.id/}&page="+page);
    DedeXHTTP = null;
    }
    LoadCommets(1);
    </script>
    在plus/feedback_ajax.php中的GetList()函数中定义评论列表的样式,调取的内容就可以了。
    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!