自定义后台模块评论页模板的修改

迅睿框架 更新 2025-11-05 12:57:17 学习狂人

看到帖子https://www.xunruicms.com/wenda/67428.html中的提问,刚好自己需要,特把解决办法记录到这里,怕下次自己后期忘记,下次再用时就有记录,同时也方便给需要的人;


如图:

修改后

自定义后台管理中的评论模板

修改文件2个:

dayrui\App\demo\Controllers\Admin\Comment.php

dayrui\App\demo\Controllers\Admin\Comment_verify.php


代码如下:

Comment.php:

<?php namespace Phpcmf\Controllers\Admin;

/**
 * 二次开发时可以修改本文件,不影响升级覆盖
 */

class Comment extends \Phpcmf\Admin\Comment
{
    public function index()
    {
        // 设置使用news自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_List();
    }
    public function add()
    {
        // 设置使用news自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_Add();
    }
    public function edit()
    {
        // 设置使用news自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_Edit();
    }
    public function review_index()
    {
        // 设置使用news自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_Review();
    }
    public function show_index()
    {
        $this->_Admin_Show();
    }
    public function del()
    {
        $this->_Admin_Del();
    }
}


Comment_verify.php

<?php namespace Phpcmf\Controllers\Admin;

/**
 * 二次开发时可以修改本文件,不影响升级覆盖
 */

class Comment_verify extends \Phpcmf\Admin\Comment
{
    public function index()
    {
        // 设置使用news自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_List();
    }
    public function edit()
    {
        // 设置使用工单自己的评论模板
        $this->tpl_prefix = 'news_comment_';
        $this->_Admin_Edit();
    }
    public function show_index()
    {
        $this->_Admin_Show();
    }
    public function del()
    {
        $this->_Admin_Del();
    }
    public function status_index()
    {
        $this->_Admin_Status();
    }
}


方案

  • 蛙蛙🌤 #1 · 2025-07-08 21:34:29
    刚好需要,感谢
  • yudeleishu #2 · 2025-10-31 13:17:11
    看看这个内容,感谢
  • 风凌君 #3 · 2025-11-01 14:23:31
    感谢分享,看看或许以后能用上
  • 小萌娃 #4 · 2025-11-05 12:57:17
    感谢分享,看看或许以后能用上

迅睿系统漏洞

CMS建站系统高级版
CMS建站系统高级版(2026-12-01)
用户权限页增加「初始化权限」 开启开发者模式后,前台栏目无权限提示会...
GeoSeo收录宝
GeoSeo收录宝(2026-12-01)
- 收录与推送 新增 抖音口令(列表可直接复制带参链接投放抖音) ...
GeoSeo工具箱
GeoSeo工具箱(2026-11-30)
新增内容创作工作台 优化CSS样式归集
分类信息
分类信息(2026-11-30)
分类信息把招聘、房产、二手、本地服务和商家收成同城门户。访客按开通城...
AI文章生成器
AI文章生成器(2026-11-30)
优化模型思考模式配置
小黄人工具箱
小黄人工具箱(2026-11-28)
新增模块列表栏目树功能
留言板
留言板(2026-11-28)
可用于在线留言,预约,反馈,询盘,后台可查看留言信息和审核
签到管理
签到管理(2026-11-27)
修复失效图标