How to use the search function in phpcms v9? phpcmsV9 How to implement the full-site search function
Let me share with you how to use the search function,
1. First, Module->Full-site search- >Add search category, add search category, the ID generated at this time is typeid
2. Add the form form, the typeid at this time is The id and siteid in the picture above are the site 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. Modify the search page 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)}未找到结果{/if} <div class="pages">{$pages}</div> {/pc}
At this point, the search page is ready.
PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!
The above is the detailed content of How to use the search function in phpcms v9. For more information, please follow other related articles on the PHP Chinese website!