上一篇 中提到后台增加了自定义的筛选条件,选择的是author字段,在前台同样需要依据author内容筛选,默认的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); //注意数据源
                    } else {
                        $data = array();
                    }

#1359 parserListLabel()

 // 扩展字段数据筛选
                    foreach ($_GET as $key => $value) {
                       if (preg_match('/^alljill|ext_[\w\-]+$/', $key)) { // 其他字段不加入
                            $where3[$key] = get($key, 'vars');
                        }
                    }
                }

现在需要解决的就是筛选项的数据来源,从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;    
    }

在模板中正确调用select标签后,实现了如下效果:

 

posted on 2023-11-14 09:00  alljill  阅读(83)  评论(0编辑  收藏  举报