迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費(fèi)且不限制商業(yè)使用,是免費(fèi)開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計(jì)理念,支持的微信公眾號、小程序、APP客戶端、移動(dòng)端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
評論系統(tǒng) 怎么設(shè)置 靜態(tài)化
目前評論調(diào)用js
怎么讓評論內(nèi)容直接顯示在源代碼里面
show.html
{php $ajax_pages=$comment_pages;} {php $list=$comment_list;} {template "comment_ajax.html"}
content類
<?php namespace Phpcmf\Model\xxx這里改成你模塊目錄; // 模塊內(nèi)容模型類 class Content extends \Phpcmf\Model\Content { // 格式化顯示內(nèi)容,用于前端內(nèi)容詳情頁面的格式化 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; // 查詢數(shù)據(jù) 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分頁 方便二次開發(fā)和重寫 */ 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(); }
{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"}
增加第一句,才能正常運(yùn)行
show.html
content類
{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"}
增加第一句,才能正常運(yùn)行