上一篇 中提到后臺增加了自定義的篩選條件,選擇的是author字段,在前臺同樣需要依據(jù)author內(nèi)容篩選,默認(rèn)的pboot:select field=* 僅支持ext_抬頭且是選擇類型的字段,在前臺如果用pboot:select field=author 是無顯示的。
apps-home-controller-parsercontroller.php
#995 add li selectall
if (get($field, 'vars')) {
$out_html = '<li><a href="' . $path . '" class="' . $class . '">' . $text . '</a> </li>';
} else {
$out_html = '<li><a href="' . $path . '" class="' . $active . '">' . $text . '</a></li>';
}
#1100 #selectauthor
if (! ! $data = $this->model->getauthorSelect(escape_string($field))) { $data = explode(',', $data); //注意數(shù)據(jù)源 } else { $data = array(); }
#1359 parserListLabel()
// 擴展字段數(shù)據(jù)篩選 foreach ($_GET as $key => $value) { if (preg_match('/^alljill|ext_[\w\-]+$/', $key)) { // 其他字段不加入 $where3[$key] = get($key, 'vars'); } } }
現(xiàn)在需要解決的就是篩選項的數(shù)據(jù)來源,從ay_extfield改為自定義
apps-home-model-parsermodel.php
#265
public function getauthorSelect($field) { for($i=2;$i<7;$i++){ $author .= parent::table(alljill')->where("id=$i")->value('authorname').',';} return $author; }
在模板中正確調(diào)用select標(biāo)簽后,實現(xiàn)了如下效果:

浙公網(wǎng)安備 33010602011771號