帝國(guó)網(wǎng)站管理系統(tǒng)4.7在繼承4.6的搜索基礎(chǔ)上新增了多條件、多字段并列搜索等功能
今天我們就專門來(lái)講解4.7的搜索改進(jìn)
回顧下4.6的搜索語(yǔ)法: 可以點(diǎn)擊這里查看:http://phome.net/doc/ecmsedu/template/makesearchform.html
相對(duì)于4.6,4.7版有什么改進(jìn)呢?下面我們一一說(shuō)明 一、支持多欄目同時(shí)搜索: 搜索多個(gè)欄目用逗號(hào)格開即可 例子:下面為搜索id=1,id=2,id=3三個(gè)欄目的信息: <input type="hidden" name="classid" value="1,2,3">
二、支持專題搜索: 搜索專題變量名:ztid 搜索多個(gè)專題可以用逗號(hào)格開,同上面的多欄目搜索 例子:下面為搜索專題ID=1的信息 <input type="hidden" name="ztid" value="1">
三、支持各種邏輯運(yùn)算聯(lián)結(jié)符: 邏輯運(yùn)算聯(lián)結(jié)符變量名:hh LT : 小于 GT : 大于 EQ : 等于 LE : 小于等于 GE : 大于等于 NE : 不等于 IN : 包含(搜索關(guān)鍵字用空格隔開每個(gè)值) BT : 范圍,兩個(gè)值之間(搜索關(guān)鍵字用空格隔開兩個(gè)值) LK : 模糊查詢(默認(rèn))
例子: 模糊查詢:<input type="hidden" name="hh" value="LK">
四、支持設(shè)置多條件查詢之間關(guān)聯(lián)關(guān)系 關(guān)聯(lián)關(guān)系變量名為:andor 有兩種關(guān)聯(lián)關(guān)系: or : 或者的關(guān)系(默認(rèn)) and : 并且的關(guān)系
例子: <input type="hidden" name="andor" value="and">
五、支持多字段、多邏輯運(yùn)算聯(lián)結(jié)符并列搜索 (一)、多字段并列搜索:有“字符串”與“數(shù)組”兩種傳遞方式 1、字符串傳遞為例子: <input type="hidden" name="hh" value="LK"> <input type="hidden" name="show" value="title,writer"> <input type="hidden" name="keyboard" value="標(biāo)題,作者"> (說(shuō)明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段包含“作者”的信息)
2、數(shù)組傳遞為例子: <input type="hidden" name="hh" value="LK"> <input type="hidden" name="show[]" value="title"> <input type="hidden" name="keyboard[]" value="標(biāo)題"> <input type="hidden" name="show[]" value="writer"> <input type="hidden" name="keyboard[]" value="作者"> (說(shuō)明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段包含“作者”的信息)
(二)、多邏輯運(yùn)算聯(lián)結(jié)符并列搜索 1、字符串傳遞為例子: <input type="hidden" name="hh" value="LK,EQ"> <input type="hidden" name="show" value="title,writer"> <input type="hidden" name="keyboard" value="標(biāo)題,作者"> (說(shuō)明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段等于“作者”的信息)
2、字符串傳遞為例子: <input type="hidden" name="show[]" value="title"> <input type="hidden" name="hh[]" value="LK"> <input type="hidden" name="keyboard[]" value="標(biāo)題"> <input type="hidden" name="show[]" value="writer"> <input type="hidden" name="hh[]" value="EQ"> <input type="hidden" name="keyboard[]" value="作者"> (說(shuō)明:上面為模糊查詢title字段包含“標(biāo)題”字符或者writer字段等于“作者”的信息)
六、新增特殊字段查詢 特殊字段包括: id : 按信息id搜索 keyboard : 按關(guān)鍵字搜索,可實(shí)現(xiàn)按tags列出信息效果 userid : 按用戶ID搜索 username : 按用戶名搜索
新增member變量:可設(shè)置只搜索會(huì)員投稿或者管理員增加的信息。
值為0則不限制 值為1則為只搜索會(huì)員投稿的信息 值為2則為只搜索管理員增加的信息 |
例子:只搜索會(huì)員投稿的信息 <input type="hidden" name="member" value="1">
七、新增新的GET提交方式 可以將數(shù)據(jù)直接提交至e/search/index.php,而不需要4.6的/search/keyword中轉(zhuǎn)。 只要在參數(shù)中加上“searchget”變量就可以了,如:/e/search/?searchget=1&keyboard=帝國(guó)&show=title
應(yīng)用例子::實(shí)現(xiàn)按標(biāo)題、作者、錄入者與信息ID同時(shí)搜索的表單

上面例子的表單html代碼:
<form name="searchform" method="post" action="/e/search/index.php"> <table width="550" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder"> <input type="hidden" name="tbname" value="news"> <input type="hidden" name="tempid" value="1"> <input type="hidden" name="andor" value="and"> <tr class="header"> <td colspan="2">新聞搜索</td> </tr> <tr bgcolor="#FFFFFF"> <td width="97">標(biāo)題:</td> <td width="388"> <input type="hidden" name="show[]" value="title"> <input type="hidden" name="hh[]" value="LK"> <input name="keyboard[]" type="text"> </td> </tr> <tr bgcolor="#FFFFFF"> <td>作者:</td> <td> <input type="hidden" name="show[]" value="writer"> <input type="hidden" name="hh[]" value="LK"> <input name="keyboard[]" type="text"> </td> </tr> <tr bgcolor="#FFFFFF"> <td>錄入者:</td> <td> <input type="hidden" name="show[]" value="username"> <input type="hidden" name="hh[]" value="EQ"> <input name="keyboard[]" type="text"> </td> </tr> <tr bgcolor="#FFFFFF"> <td>信息ID范圍:</td> <td> <input type="hidden" name="show[]" value="id"> <input type="hidden" name="hh[]" value="BT"> <input name="keyboard[]" type="text"> <font color="#666666">(例:“1 6”表示1到6之間) </font></td> </tr> <tr bgcolor="#FFFFFF"> <td> </td> <td> <input type="submit" name="Submit" value="馬上搜索"> <font color="#666666">(不設(shè)置為不限)</font></td> </tr> </table> </form>
新版搜索功能支持各種字段、運(yùn)算組合搜索,更多應(yīng)用期待您去實(shí)踐,至此本節(jié)講解完畢。
更多帝國(guó)網(wǎng)站管理系統(tǒng)V4.7解密請(qǐng)聽(tīng)下回分解。 |
|
|
|