9

PbootCMS如何实现后台列表页搜索字段修改为自定义字段

 2 years ago
source link: https://www.huhexian.com/18713.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

PbootCMS如何实现后台列表页搜索字段修改为自定义字段

青山 2021-12-2214:59:30评论487字

我们在使用PbootCMS制作网站的时候,创建新模型后,导致后台列表显示页中的搜索功能失效,很多小伙伴不知道是什么原因造成的,其实那是因为搜索字段默认为title而我们要搜索的不是这个字段,所以就搜索不出你所要的内容。下面就来为大家解决PbootCMS后台列表页搜索字段修改为自定义字段。

PbootCMS如何实现后台列表页搜索字段修改为自定义字段

首页打开 apps–>admin–>model–>content 中的 ContentModel.php 文件。

修改函数 public function findContent($mcode, $scode, $keyword) 中相关代码:

在大概 115 行处加入 ‘content_ext.*’ 代码;

在大概 134 行处加入以下代码:

  1. array(
  2. 'ay_content_ext content_ext',
  3. 'a.id=content_ext.contentid',
  4. 'LEFT'

在大概 147 行处 把原来的代码 ->like(‘a.title’, $keyword) 修改成你要搜索的自定义字段 ->like(‘content_ext.ext_zsm’, $keyword),修改完后的效果图如下:

PbootCMS如何实现后台列表页搜索字段修改为自定义字段

历史上的今天

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK