咨询热线:
88888888
今天群友咨询副标题及自定义字段的搜索,其实很简单,apps/admin/model/content/ContentModel.php 中 在
// 查找指定分类及子类文章 及 // 在全部栏目查找文章 中
将 ->like('a.title', $keyword) 改为 ->like('a.title,a.subtitle', $keyword)
如果需要查找自定义字段,需要在 $fields = array ( 里将自定义字段添加好,然后在like里添加上即可。
示例代码 增加查询 ext_price 自定义字段内容
1,,// 查找指定分类及子类文章
array( 'ay_model d', 'b.mcode=d.mcode', 'LEFT' ), 以下添加为下面代码 array( 'ay_content_ext content_ext', 'a.id=content_ext.contentid', 'LEFT' )
->like('a.title', $keyword) 替换为以下代码 如要查义多个中间加逗号 ->like('a.title,ext_price', $keyword)
2,,// 在全部栏目查找文章
array( 'ay_content_ext content_ext', 'a.id=content_ext.contentid', 'LEFT' )
->like('a.title', $keyword) 替换为以下代码 如要查义多个中间加逗号 ->like('a.title,ext_price', $keyword)
转载请附上原文出处链接及本声明。
原文链接:https://www.pboot.cn/article/139.html