請問大神,search頁面怎么篩選出評論為零的內(nèi)容模塊?
下面我是按照評論篩選的模塊,不止為零的怎么篩選
<a href="{Router::search_url($params, 'order', 'comments')}" class="{if $params.order=='comments'}on{/if}">等待回答</a>
</div>
<div class="q_cons">
<div class="box">
<ul class="list_a">
{module module=wenda order=$params.order page=1 urlrule=$urlrule num=10}
<li>
官方提醒:使用module內(nèi)容循環(huán)標(biāo)簽的生成工具,填寫參數(shù)就可以生成相關(guān)的代碼,每個參數(shù)后面都有用法解釋
comments>0
參考文檔:《重寫搜索Search類》
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅??蚣軇?chuàng)始人 不太明白怎么寫
回復(fù)迅??蚣軇?chuàng)始人 我需要篩選出評論為0的文章
comments=0 評論為0的文章
改search文件
<a href="{Router::search_url($params, 'order', 'comments=0')}" class="{if $params.order=='comments=0'}on{/if}">等待回答</a>
這樣寫不對
回復(fù)@靠懸賞(設(shè)置懸賞)賺錢買授權(quán)
<a href="{Router::search_url($params, 'order', 'comments=0')}" class="{if $params.order=='comments=0'}on{/if}">等待回答</a>
這樣寫不對
用一樓的文檔啊
我們以Demo模塊為例,新建App/Demo/Models/Search.php
<?php namespace Phpcmf\Model\Demo; // 模塊內(nèi)容搜索類 class Search extends \Phpcmf\Model\Search { // 獲取搜索參數(shù) public function get_param($module) { list($catid, $get) = parent::get_param($module); // 這里可以重組$get變量 return [$catid, $get]; } // 自定義組合查詢條件 protected function mysearch($module, $where, $get) { // 重新對where條件的組裝 // 比如我加一個條件作為搜索條件 $where[] = "comments=0"; // 表加一個zt字段=1的數(shù)據(jù) return $where; } }