想在后台的全局表单内容列表里,操作选项里加一个右侧链接按钮

迅睿框架 更新 2024-04-09 23:03:59 求知若渴虚心若愚

想在后台的全局表单内容列表里,操作选项里加一个右侧链接按钮,参考了

Table操作类-列表右侧链接和底部按钮写法

https://www.xunruicms.com/doc/1232.html

后台模块控制器继承重写

https://www.xunruicms.com/doc/1352.html


我的代码是这样的

// 数据列表
public function index() {
 $tpl = $this->_Admin_List(true);
 $this->mytable = [
  'foot_tpl' => '', // 底部按钮字符串
  'link_tpl' => '', // 右侧侧链接字符串
  'link_var' => 'html = html.replace(/\{id\}/g, row.id);', // 侧链接的js变量替换,例如{id}表示id
 ];

 // 侧链接,加一个a标签链接
 $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';

 \Phpcmf\Service::V()->assign([
  'mytable' => $this->mytable,
 ]);
 return \Phpcmf\Service::V()->display($tpl);
}

为什么只剩下侧链接一个按钮了?没加侧链接代码之前数据列表正常显示的。

QQ图片20240409083427.png

方案

  • 开源社区插件技术-小鹏 #1 · 2024-04-09 08:39:53
    // 数据列表
    public function index() {
     $tpl = $this->_Admin_List(true);
    
    
     // 侧链接,加一个a标签链接
     $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';
    
     \Phpcmf\Service::V()->assign([
      'mytable' => $this->mytable,
     ]);
     return \Phpcmf\Service::V()->display($tpl);
    }
  • 求知若渴虚心若愚 #2 · 2024-04-09 13:35:31
    开源社区插件技术-小鹏 图标显示正常了,数据列表还是无法显示
    QQ图片20240409133338
  • 求知若渴虚心若愚 #3 · 2024-04-09 13:42:48
    list($tpl) = $this->_List();能显示数据列表,但是左侧那些按钮图标又不显示了。。。。
  • 开源社区插件技术-小鹏 #4 · 2024-04-09 14:14:54
    满意答案
    // 数据列表
    public function index() {
     $tpl = $this->_Admin_List(true);
    
     $this->mytable = \Phpcmf\Service::V()->get_value("mytable");
     // 侧链接,加一个a标签链接
     $this->mytable['link_tpl'].= '<label><a href="'.dr_url(APP_DIR.'/customer/show').'&id={id}" class="btn btn-xs blue"> <i class="fa fa-user"></i> 测试</a></label>';
    
     \Phpcmf\Service::V()->assign([
      'mytable' => $this->mytable,
     ]);
     return \Phpcmf\Service::V()->display($tpl);
    }
  • 求知若渴虚心若愚 #5 · 2024-04-09 23:03:59
    @开源社区插件技术-小鹏:已解决,多谢小鹏

迅睿系统漏洞

GeoSeo收录宝
GeoSeo收录宝(2026-09-01)
升级 ai智能发布功能 升级 支持8国语言后端设置和前端输出功能 ...
Word发布批量上传
Word发布批量上传(2026-08-31)
版本覆盖问题重发
多语言翻译Seolang
多语言翻译Seolang(2026-08-31)
新增 LLM 大模型对话翻译模块 配置层强类型化重构 URL 模...
自定义存储
自定义存储(2026-08-30)
同步服务器端通用版实现,统一管理端、CMS 端和浏览器直传的提示与错...
GeoSeo工具箱
GeoSeo工具箱(2026-08-29)
新增 bing推送 新增 IndexNow推送 新增 baidu...
外贸多语言建站
外贸多语言建站(2026-08-27)
新增阿里云专业版入口 新增阿里云自动识别字符格式
Querylist渐进式采集
Querylist渐进式采集(2026-08-26)
增加范围截取规则
实时任务
实时任务(2026-08-26)
补充并整理完整使用说明、历史版本更新日志,统一帮助页样式。