联系官方销售客服

1835022288

028-61286886

应用插件 版主:官方插件技术组
评论系统 怎么让评论内容直接显示在源代码里面
类型:迅睿CMS 更新时间:2022-04-28 12:04:43 评论系统
插件 评论系统 V2.41
应用作者 迅睿官方团队
发布时间 2020-06-07 02:23:50
更新时间 2024-01-14 17:52:45


评论系统 怎么设置 静态化


目前评论调用js  

image


怎么让评论内容直接显示在源代码里面 

插件教程:https://www.xunruicms.com/doc/app-596.html

回帖
  • qqd
    #1楼    qqd
    2022-04-15 10:16:31
    Chrome 0
    增加悬赏(设置悬赏)金:2元,希望大家给予帮助!
  • 张小佛
    #2楼    张小佛
    2022-04-15 10:41:29
    Chrome 0
    简单啊,参考官方的wenda插件默认模板写法
  • 小波工作室--标签和API大师
    #3楼    小波工作室--标签和API大师
    2022-04-15 12:27:42
    Chrome 0
    show.html
    {php $ajax_pages=$comment_pages;}
    {php $list=$comment_list;}
    {template "comment_ajax.html"}

    content类
    <?php namespace Phpcmf\Model\xxx这里改成你模块目录;
    
    // 模块内容模型类
    
    class Content extends \Phpcmf\Model\Content {
    
    
        // 格式化显示内容,用于前端内容详情页面的格式化
        public function _call_show($data) {
    
            $cache = \Phpcmf\Service::L('cache')->get('app-comment-'.SITE_ID, 'module', MOD_DIR);
            if (!$cache) {
                return $data;
            } elseif (!$cache['use']) {
                return $data;
            }
    
            if (!isset($cache['order']) || !$cache['order']) {
                $cache['order'] = 'inputtime desc';
            }
    
            $page = max(1, (int)\Phpcmf\Service::L('input')->get('page'));
    
            if (IS_API_HTTP) {
                $pagesize = (int)$cache['pagesize_api'];
            } elseif (\Phpcmf\Service::IS_MOBILE()) {
                $pagesize = (int)$cache['pagesize_mobile'];
            } else {
                $pagesize = (int)$cache['pagesize'];
            }
            !$pagesize && $pagesize = 10;
    
            // 查询数据
            list($list, $total) = $this->get_comment_result($data['id'], $cache['order'], $page, $pagesize, 0, $cache['field']);
    
            $data['index'] = $data;
            $data['comment_list'] = $list;
            $data['comment_pages'] = $this->_get_pages(\Phpcmf\Service::L('Router')->show_url(\Phpcmf\Service::C()->module, $data, '{page}'), $total, $pagesize);
            $data['comment_cache'] = $cache;
    
            return $data;
        }
    
        /**
         * 评论ajax分页 方便二次开发和重写
         */
        protected function _get_pages($url, $total, $pagesize) {
    
            $config = [];
    
            $file = 'config/page/'.(\Phpcmf\Service::IS_PC() ? 'pc' : 'mobile').'/ajax.php';
            if (is_file(WEBPATH.$file)) {
                $config = require WEBPATH.$file;
            } elseif (is_file(ROOTPATH.$file)) {
                $config = require ROOTPATH.$file;
            } else {
                $config['next_link'] = '>';
                $config['prev_link'] = '<';
                $config['last_link'] = '>|';
                $config['first_link'] = '|<';
                $config['cur_tag_open'] = '<a class="ds-current">';
                $config['cur_tag_close'] = '</a>';
            }
    
            $config['base_url'] = $url;
            $config['per_page'] = $pagesize;
            $config['total_rows'] = $total;
            $config['use_page_numbers'] = TRUE;
            $config['query_string_segment'] = 'page';
    
            return \Phpcmf\Service::L('Page')->initialize($config)->create_links();
        }
  • 小黄人 18html
    #4楼    小黄人 18html
    2022-04-28 12:04:43
    Chrome 0
    {php $post_url="/index.php?s=".MOD_DIR."&c=comment&id=".$id;}{php $ajax_pages=$comment_pages;}{php $list=$comment_list;}{template "comment_ajax.html"}增加第一句,才能正常运行