發(fā)布日期: 2024-05-24 | 來源: 智軟設(shè)計工作室
我們在后臺模型里面新增了自定義字段后,然后想要在后臺搜索哪里。能搜索。需要處理下。
首先打開。
apps/admin/model/content/ContentModel.php
主要更改二個函數(shù)
// 查找指定分類及子類文章
public function findContent($mcode, $scode, $keyword)
// 在全部欄目查找文章
public function findContentAll($mcode, $keyword)
我下面貼出來。具體得修改。大家舉一反三
// 查找指定分類及子類文章
public function findContent($mcode, $scode, $keyword)
{
$fields = array(
'a.id',
'b.name as sortname',
'a.scode',
'c.name as subsortname',
'a.subscode',
'a.title',
'a.subtitle',
'a.date',
'a.sorting',
'a.status',
'a.istop',
'a.isrecommend',
'a.isheadline',
'a.visits',
'a.ico',
'a.pics',
'a.filename',
'a.outlink',
'd.urlname',
'b.filename as sortfilename',
'content_ext.ext_orderno'//這里增加要查詢得自定義字段
);
$join = array(
array(
'ay_content_sort b',
'a.scode=b.scode',
'LEFT'
),
array(
'ay_content_sort c',
'a.subscode=c.scode',
'LEFT'
),
array(
'ay_model d',
'b.mcode=d.mcode',
'LEFT'
),
array('ay_content_ext content_ext',
'a.id=content_ext.contentid', 'LEFT') //這里增加要查詢得自定義字段和表
);
$this->scodes = array(); // 先清空
$scodes = $this->getSubScodes($scode);
return parent::table('ay_content a')->field($fields)
->where("b.mcode='$mcode'")
->where('d.type=2 OR d.type is null ')
->where("a.acode='" . session('acode') . "'")
->in('a.scode', $scodes)
->like('a.title,content_ext.ext_orderno', $keyword)//這里加入查詢得自定義字段
->join($join)
->order('a.sorting ASC,a.id DESC')
->page()
->select();
}
// 在全部欄目查找文章
public function findContentAll($mcode, $keyword)
{
$fields = array(
'a.id',
'b.name as sortname',
'a.scode',
'c.name as subsortname',
'a.subscode',
'a.title',
'a.subtitle',
'a.date',
'a.sorting',
'a.status',
'a.istop',
'a.isrecommend',
'a.isheadline',
'a.visits',
'a.ico',
'a.pics',
'a.filename',
'a.outlink',
'd.urlname',
'b.filename as sortfilename',
'content_ext.ext_orderno'//這里增加要查詢得自定義字段
);
$join = array(
array(
'ay_content_sort b',
'a.scode=b.scode',
'LEFT'
),
array(
'ay_content_sort c',
'a.subscode=c.scode',
'LEFT'
),
array(
'ay_model d',
'b.mcode=d.mcode',
'LEFT'
),
array('ay_content_ext content_ext',
'a.id=content_ext.contentid', 'LEFT')//這里增加要查詢得自定義字段
);
return parent::table('ay_content a')->field($fields)
->where("b.mcode='$mcode'")
->where('d.type=2 OR d.type is null ')
->where("a.acode='" . session('acode') . "'")
//->like('a.title', $keyword)
->like('a.title,content_ext.ext_orderno', $keyword)//這里增加要查詢得自定義字段
->join($join)
->order('a.sorting ASC,a.id DESC')
->page()
->select();
}2022-06-09
我們有的時候爬一些網(wǎng)站,會出現(xiàn)一些版權(quán)html注釋在里面。手動刪除起來麻煩下面直接用這個正則表達式 刪除注釋HTTrack Website和 webzip版權(quán) 應(yīng)該都可以用。webzip目前還沒測試去掉 注釋 標(biāo)記<!--[/!]*?[^<>]*?>下面在分享一些其他常用的正則<[/!]*?[^<>]*?>去掉HTML 
閱讀更多2025-03-11
事情是這樣的。我在windows環(huán)境測試都是后的。然后轉(zhuǎn)移到linux環(huán)境。出現(xiàn)一個問題,就是有一個欄目要登陸后才能查看。但是他沒有跳轉(zhuǎn)。直接出現(xiàn)404,一開始以為是偽靜態(tài)的問題。但是排查了下。不是這個問題,然后就找了下 出現(xiàn)這個錯誤的代碼,具體修改是。注銷這個自定義跳轉(zhuǎn)到404代碼。當(dāng)調(diào)用出現(xiàn)問題或者數(shù)據(jù)庫字段不一致
閱讀更多2022-12-09
PbCMS判斷是否有子欄目,二級三級四級都能判斷,然后可以寫不同的樣式運行,默認的 {pboot:nav parent={sort:scode}}不行,空的時候不執(zhí)行,查出來數(shù)據(jù)[nav:soncount] 也是0,很奇怪。但是這個頭部導(dǎo)航是可以,列表的時候有的要調(diào)用目錄和內(nèi)容一起循環(huán),沒有子子目錄直接內(nèi)容,就一直實現(xiàn)不了,看了個csdn技術(shù)人改的,我這里
閱讀更多2025-03-07
pb有時候給欄目加權(quán)限的時候,提示權(quán)限默認是2s頁面跳轉(zhuǎn) 有點麻煩,甚至不想要這個跳轉(zhuǎn)提示頁面按照路徑找到 /core/function/handle.php把默認的1000改成你需要的時間 1000是1s 0就是直接跳轉(zhuǎn),但是0在直接跳轉(zhuǎn)時候 會有一個頁面馬上閃爍跳轉(zhuǎn),可以把這個頁面暫時display: none。找到路徑 /core/template/error.html找到之后
閱讀更多2023-03-15
解決方案使用Referer Meta標(biāo)簽控制referer,在H5 的 header加入meta<metaname="referrer"content="never">
閱讀更多2022-05-18
今天在用FIlezilla 鏈接阿里云虛擬主機FTP ,提示421 There are too many connections from your internet address.但是查看了設(shè)置都沒錯。網(wǎng)上有的說。把并發(fā)設(shè)置為1.但是測試了還是不行。我發(fā)現(xiàn)是要把密碼類型設(shè)置為明文才行。。如下圖:
閱讀更多2022-12-05
<title>jQuery事件-微信的顯示隱藏及鼠標(biāo)的移入移出</title><scriptsrc="/imgjs/jquery-1.11.3.min.js"></script></head><body><divstyle="width:230px;height:200px;background-color:#333;position:relative;"&
閱讀更多2024-12-11
主要修改 // 查找指定分類及子類文章 public function findContent($mcode, $scode, $keyword)和// 在全部欄目查找文章 public function findContentAll($mcode, $keyword) {怎么修改我截圖下來了。先把擴展表字段都加入進去,然后在加入left,然后在加入要搜索的字段就可以了
閱讀更多2023-06-16
<?php/*重點代碼,因為PB的模板解析執(zhí)行順序,{label:**}無法直接被php解析到,我們直接讀取數(shù)據(jù),*/$list=\core\basic\Db::table('ay_label')->field('value')->where("name='Facebook'")->find();$ip1=$list->value;$ip
閱讀更多