迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
评论系统 怎么设置 静态化
目前评论调用js
怎么让评论内容直接显示在源代码里面
插件教程:https://www.xunruicms.com/doc/app-596.html
{php $ajax_pages=$comment_pages;} {php $list=$comment_list;} {template "comment_ajax.html"}
<?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(); }
content类