您好,登錄后才能下訂單哦!
phpcms v9實(shí)現(xiàn)搜索功能的方法?這個問題可能是我們?nèi)粘W(xué)習(xí)或工作經(jīng)常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!
phpcms v9搜索功能怎么做?phpcmsV9 全站搜索功能如何實(shí)現(xiàn)
給大家分享一下如何運(yùn)用搜索功能吧,
1. 首先, 模塊->全站搜索->添加搜索分類,添加搜索分類,此時生成的ID為typeid
2. 添加form表單,此時的typeid即為上圖的id,siteid為站點(diǎn)的id
<form method="get" action="{APP_PATH}index.php" target="_blank"> <td width="">搜索:</td> <td width=""> <input type="text" name="q" id="q" value="" class="inputCom" style="width:196px; height:22px; line-height:22px;"> <input type="hidden" name="m" value="search"/> <input type="hidden" name="c" value="index"/> <input type="hidden" name="a" value="init"/> <input type="hidden" name="typeid" value="{$typeid}" id="typeid"/> <input type="hidden" name="siteid" value="{$siteid}" id="siteid"/> </td> <td width=""><input type="image" src="{IMG_PATH}sousuo.jpg" border="0" class="sousuo" id="search_btn"></td> </form>
3.修改搜索頁面 phpcms\templates\default\search\list.html
{pc:get sql="SELECT * FROM `表名` where title like '%$q%' order by id DESC " num="10" page="$page" return="data"} {loop $data $r} <tr> <td width="500" align="left" style="margin-top:2px; ">· <a href="{$r[url]}" title="{$r[title]}" class="centerTitle" style="text-decoration:none" >{$r[title]}</a></td> <td width="200" align="right" style="color:#FF6600;margin-top:2px;">{date('Y-m-d',$r[inputtime])}</td> </tr> {/loop} {if empty($data)}未找到結(jié)果{/if} <div class="pages">{$pages}</div> {/pc}
此時,搜索頁面就可以了。
感謝各位的閱讀!看完上述內(nèi)容,你們對phpcms v9實(shí)現(xiàn)搜索功能的方法大概了解了嗎?希望文章內(nèi)容對大家有所幫助。如果想了解更多相關(guān)文章內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。