聯(lián)系官方銷售客服
1835022288
028-61286886
搜索篩選實(shí)現(xiàn)最近1個(gè)月等最近時(shí)間的篩選搜索方法分享
以官方示例為例,時(shí)間的搜索篩選只能是按時(shí)間段。
2012/1/1,2019/1/1_示例_迅睿CMS框架演示站 (xunruicms.com)
時(shí)間范圍的搜索寫法,內(nèi)容搜索,PHP開源CMS系統(tǒng)幫助文檔 (xunruicms.com)
只提供了時(shí)間范圍的搜索寫法。
分享一個(gè)在search.html頁,篩選最近時(shí)間的方法:
上代碼:
<div class="form-group row"> <label class="col-md-2 control-label">發(fā)布時(shí)間</label> <div class="col-md-9"> {php $day = $_GET["day"]} <label><a class="label {if !$day}label-success{else}label-default{/if}" href="{Router::search_url($params, 'diqu', NULL)}">不限</a></label> <!--調(diào)用單選字段數(shù)據(jù)方法--> <label><a class="label {if $day==7}color-1{/if}" href="{Router::search_url($params, 'day', 7)}">近一周</a></label> <label><a class="label {if $day==7}color-1{/if}" href="{Router::search_url($params, 'day', 30)}">近一月</a></label> <label><a class="label {if $day==7}color-1{/if}" href="{Router::search_url($params, 'day', 90)}">近三個(gè)月</a></label> <label><a class="label {if $day==7}color-1{/if}" href="{Router::search_url($params, 'day', 180)}">近半年</a></label> <label><a class="label {if $day==7}color-1{/if}" href="{Router::search_url($params, 'day', 365)}">近一年</a></label> </div> </div>
搜索循環(huán)標(biāo)簽
{search module=MOD_DIR id=$searchid total=$sototal DAY_inputtime=$day order=$params.order catid=$catid page=1 pagesize=10 urlrule=$urlrule}
也就是增加了 DAY_inputtime=$day
這是發(fā)布時(shí)間,如果是更新時(shí)間,就改成
DAY_updatetime
這樣你就破壞了search標(biāo)簽了,官方說search標(biāo)簽參數(shù)是固定的,不能隨意增加,估計(jì)會(huì)影響搜索的統(tǒng)計(jì)總量
回復(fù)@Supreme
這只是增加一個(gè)字段條件,不存在什么破壞search標(biāo)簽
利用的是 循環(huán)修飾符 中的 DAY_字段。
相關(guān)文檔:條件循環(huán)修飾符、通配符,標(biāo)簽調(diào)用,PHP開源CMS系統(tǒng)幫助文檔 (xunruicms.com)
回復(fù)@Supreme
可以正確查詢到數(shù)據(jù),不過確實(shí)搜索結(jié)果的統(tǒng)計(jì)總數(shù)是不對的。被文檔誤導(dǎo)了。
現(xiàn)在官方已經(jīng)去掉search的支持了