When you develop a website using PbootCMS, you may encounter the situation that the search function does not search for any data, even if there is content matching the search keywords in the database. This article will introduce how to solve the problem that no data is found in the PbootCMS search, and how to use the PbootCMS multi criteria search function.
Solution: Search all column contents
When we use the PbootCMS search function, if the search result is empty, but there is content in the database that meets the search criteria, this may be because the search scope is limited to a certain column, and the content in the database does not belong to that column. At this time, you can add a scdoe=* tag to search the contents of all columns to solve this problem. The following is sample code:
{pboot:search num=12 order=sorting scode=* field='title|content'} {/pboot:search}
Through the scdoe=* tag in the above code, the function of searching all column contents can be realized, so as to solve the problem that no data is found in the search.
Multi condition search
In addition to basic search, PbootCMS also provides a multi criteria search function, which allows you to set search criteria according to your own needs, such as search title, content, or author. The following is an example of a multi criteria search code:
<form action="{pboot:scaction}" method="get"> Content:<input type="text" name="content"> Title:<input type="text" name="title"> Author:<input type="text" name="author"> <input type="hidden" name="scode" value="2,3" > <button type="submit">Search</button> </form>
In the above code,<input type="hidden" name="score" value="2,3 ″>indicates the ID value of the specified search column. Multiple columns can be separated by commas. For example, the above code specifies that the search column is the column with ID 2 and 3.
The following is an example of a search results list code:
{pboot:search} <a href="search:link">search:title</a> {/pboot:search}
The above code can be used to display the search results, where search: link and search: title represent the link and title of the search results respectively.
summary
PbootCMS provides rich search functions, including basic search and multi condition search, which can meet different needs of website development. When the search does not find any data, you can add the scdoe=* tag to search all column contents to solve the problem. At the same time, the multi criteria search function can also help us obtain the required content more accurately.