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

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

迅睿系统漏洞

站群分站系统
站群分站系统(2026-10-15)
子站域名新增llms.txt访问
GEO系统
GEO系统(2026-10-14)
修复下载zip空白地址问题 修复流量复刻和任务队列错误
GeoSeo收录宝
GeoSeo收录宝(2026-10-14)
新增 站长工具箱 前端首页自动调用meta 数据
滑块验证码 Gocaptcha
滑块验证码 Gocaptcha(2026-10-13)
基于开源项目 go-captcha 的行为验证码插件,滑动拼图、区域...
GeoSeo工具箱
GeoSeo工具箱(2026-10-13)
优化巡检任务
GeoSeo排名助手
GeoSeo排名助手(2026-10-11)
加入大模型自定义
SEO聚合关键字
SEO聚合关键字(2026-10-11)
优化关键字列表页最多支持1万篇文章,过多会导致服务器扛不住;
CMS内容同步复制
CMS内容同步复制(2026-10-10)
增加时间是否更新的开关