Home  >  Article  >  CMS Tutorial  >  How to search with multiple conditions in Empire CMS

How to search with multiple conditions in Empire CMS

尚
Original
2019-07-27 17:41:253226browse

How to search with multiple conditions in Empire CMS

Empire cms multi-condition search:

1. Support multi-column simultaneous search:
Use commas to search for multiple columns. Can
Example: The following is the search for information in the three columns of id=1, id=2, and id=3:


2. Support topic search:
Search topic variable name: ztid
Search for multiple topics can be separated by commas, the same as the above multi-column search
Example: The following is Search information for topic ID=1


3. Support various logical operation connectors:
Logic Operation connector variable name: hh
LT: less than
GT: greater than
EQ: equal to
LE: less than or equal to
GE: greater than or equal to
NE: not equal to
IN : Contains (the search keyword separates each value with a space)
BT: Range, between two values ​​(the search keyword separates the two values ​​with a space)
LK: Fuzzy query (default)

Example:
Fuzzy query:

4. Support setting the association between multi-condition queries
The associated relationship variable name is: andor
There are two associated relationships:
or: or relationship (default)
and: and relationship

Example:



5. Support multi-field, multi-logical operation connector parallel search
(1), multi-field parallel search Search: There are two transmission methods: "string" and "array"
1. String transmission is an example:

<input type="hidden" name="hh" value="LK">
<input type="hidden" name="show" value="title,writer">
<input type="hidden" name="keyboard" value="标题,作者">


(Note: The above is a fuzzy query where the title field contains " Title" character or the writer field contains "author" information)

2. Array transfer is an example:

<input type="hidden" name="hh" value="LK">
<input type="hidden" name="show[]" value="title">
<input type="hidden" name="keyboard[]" value="标题">
<input type="hidden" name="show[]" value="writer">
<input type="hidden" name="keyboard[]" value="作者">


(Note: The above is a fuzzy query where the title field contains " Title" character or the writer field contains "author" information)

(2) Parallel search with multiple logical operation connectors
1. Example of string transfer:

<input type="hidden" name="hh" value="LK,EQ">
<input type="hidden" name="show" value="title,writer">
<input type="hidden" name="keyboard" value="标题,作者">


(Note: The above is a fuzzy query for information that the title field contains the "title" character or the writer field is equal to "author")

2. Example of string transfer:

<input type="hidden" name="show[]" value="title">
<input type="hidden" name="hh[]" value="LK">
<input type="hidden" name="keyboard[]" value="标题">
<input type="hidden" name="show[]" value="writer">
<input type="hidden" name="hh[]" value="EQ">
<input type="hidden" name="keyboard[]" value="作者">


(Note: The above is a fuzzy query for information that the title field contains the "title" character or the writer field is equal to "author")

6. New special field query
Special fields include:
id: Search by information ID
keyboard: Search by keyword, which can achieve the effect of listing information by tags
userid: Search by user ID
username: Search by user name

Added member variable: You can set it to search only for member contributions or information added by administrators.
If the value is 0, there is no restriction.
If the value is 1, it will only search for information submitted by members.
If the value is 2, it will only search for information added by the administrator.

Example: Only search for member submissions Information


7. Add a new GET submission method
You can submit data directly to e /search/index.php, without the need for 4.6’s /search/keyword transfer.
Just add the "searchget" variable to the parameter, such as: /e/search/?searchget=1&keyboard=Empire&show=title


Application example:: Realize by title, Form for simultaneous search of author, entry person and information ID

How to search with multiple conditions in Empire CMS

How to search with multiple conditions in Empire CMS

##HTML code:

<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">
<b><input type="hidden" name="andor" value="and"></b>
<tr class="header">
<td colspan="2">新闻搜索</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="97">标题:</td>
<td width="388">
<b>   <input type="hidden" name="show[]" value="title">
<input type="hidden" name="hh[]" value="LK">
<input name="keyboard[]" type="text"></b>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>作者:</td>
<td>
<b>   <input type="hidden" name="show[]" value="writer">
<input type="hidden" name="hh[]" value="LK">
<input name="keyboard[]" type="text"></b>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>录入者:</td>
<td>
<b>   <input type="hidden" name="show[]" value="username">
<input type="hidden" name="hh[]" value="EQ">
<input name="keyboard[]" type="text"></b>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>信息ID范围:</td>
<td>
<b>   <input type="hidden" name="show[]" value="id">
<input type="hidden" name="hh[]" value="BT">
<input name="keyboard[]" type="text"></b>
<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">(不设置为不限)</font></td>
</tr>
</table>
</form>

The above is the detailed content of How to search with multiple conditions in Empire CMS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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