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

迅睿框架 更新 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
    感谢分享,看看或许以后能用上

迅睿系统漏洞

IP138查询
IP138查询(2026-09-02)
转换本地ip地址作用。后台安装/启用插件 Ip_ysb进入「应用 →...
GEO系统
GEO系统(2026-09-02)
支持最新的ai优化算法 后台增加可控制的站点运营管理
开发者工具
开发者工具(2026-09-02)
增加插件脚手架 增加控制器编写辅助
用户系统
用户系统(2026-09-02)
增强用户列表安全验证,防止个人信息泄露
节日灯笼
节日灯笼(2026-09-01)
新增顶部节日横幅 Banner ,祝福语文字 新增节日特效:Can...
GeoSeo收录宝
GeoSeo收录宝(2026-09-01)
升级 ai智能发布功能 升级 支持8国语言后端设置和前端输出功能 ...
Word发布批量上传
Word发布批量上传(2026-08-31)
版本覆盖问题重发
多语言翻译Seolang
多语言翻译Seolang(2026-08-31)
新增 LLM 大模型对话翻译模块 配置层强类型化重构 URL 模...