分享经验 版主:论坛审计组
自定义后台模块评论页模板的修改
类型:迅睿CMS 更新时间:2025-05-14 10:51:01

看到帖子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();
    }
}


回帖