Home > CMS Tutorial > PHPCMS > How to use the search function in phpcms v9

How to use the search function in phpcms v9

藏色散人
Release: 2020-02-03 10:57:33
Original
3748 people have browsed it

How to use the search function in phpcms v9

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

How to use the search function in phpcms v9

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>
Copy after login

3. Modify the search page phpcms\templates\default\search\list.html

{pc:get sql="SELECT * FROM `表名` where title like &#39;%$q%&#39; 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(&#39;Y-m-d&#39;,$r[inputtime])}</td>
    </tr>
    {/loop}
    {if empty($data)}未找到结果{/if}
    <div class="pages">{$pages}</div>
{/pc}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template