DMS search form syntax rules

Source: Internet
Author: User

Dpc cms provides powerful search result calling. You can use the dpc cms search form syntax to create most of the search functions that meet your needs. If you have custom fields in your database, you may need to modify the data processing for form submission by e/search/index. php. refer to the example provided at the end of the article. Let's take a look at the description of the search form variables:

Variable name Description Example
Search form submission address POST method:/e/search/index. php <Form name = "searchform" method = "post" action = "/e/search/index. php">
GET method:/e/search /? Searchget = 1 /E/search /? Searchget = 1 & keyboard = empire & show = title
Keyboard Search for keyword Variables <Input name = "keyboard" type = "text">
Show Search for field variables (use "," to separate multiple fields. The search field must be the field for enabling search in the background model) <Input type = "hidden" name = "show" value = "title, newstext">
Classid Search topic ID (not limited, multiple columns are available) <Input type = "hidden" name = "classid" value = "1">
Ztid Search topic ID (not limited, multiple topics are available "," lattice) <Input type = "hidden" name = "ztid" value = "1">
Tbname Search by data table (combined with the search template ID) <Input type = "hidden" name = "tbname" value = "news">
Tempid Search template ID used (generally used in combination with table-based search) <Input type = "hidden" name = "tempid" value = "1">
Starttime and endtime Information of the start time and end time of the search respectively (not limited to. Format: 2008-02-27) <Input name = "starttime" type = "text" value = "0000-00-00" size = "12">
<Input name = "endtime" type = "text" value = "0000-00-00" size = "12">
Startprice and endprice They are the starting price and ending price of the commodity price (not limited) <Input name = "startprice" type = "text" value = "0" size = "6">
<Input name = "endprice" type = "text" value = "0" size = "6">
Search for special fields Id: search by information ID
Keyboard: search by keyword (information can be listed by tags)
Userid: search by publisher user ID
Username: search by publisher User Name
<Input type = "hidden" name = "show" value = "keyboard">
Member If the value is 0, no restriction is imposed.
If the value is 1, the system only searches for information contributed by members.
If the value is 2, only search for information added by the Administrator.
<Input type = "hidden" name = "member" value = "1">
Orderby Sorting field:
0: by release date (default)
1: By ID
2: by number of comments
3: by browsing popularity
4: by number of downloads
<Input type = "hidden" name = "orderby" value = "1">
Myorder Sorting method:
0: Reverse Order (default)
1: ordered
<Input type = "hidden" name = "myorder" value = "1">
Andor Set the association relationship between multi-condition queries. There are two types:
Or: or relationship (default)
And: and relationship
<Input type = "hidden" name = "andor" value = "and">
Hh Logical operation connector variable:
LT: less
GT: greater
EQ: equal
LE: less than or equal
GE: greater than or equal
NE: not equal
IN: Contains (keywords are separated by spaces)
BT: range, between two values (the search keywords are separated by spaces)
LK: fuzzy query (default)
<Input type = "hidden" name = "hh" value = "LK">

The following is an example:

<Table width = "320" border = "0" cellspacing = "1" cellpadding = "3"> <form name = "searchform" method = "post" action = "/e /search/index. php "> <tr> <td> Keyword: <input name =" keyboard "type =" text "size =" 10 "> </td> <td> range: <select name = "show"> <option value = "title"> title </option> <option value = "smalltext"> introduction </option> <option value = "newstext "> content </option> <option value =" writer "> author </option> <option value =" title, smalltext, newstext, writer "> Search all </option> </select> </td> </tr> <td> column: <select name = "classid"> <option value = "0"> Search all </option> <option value = "1"> News Center </option> <option value = "4"> Technical Documentation </option> <option value = "22"> download center </option> </select> </td> <input type =" submit "name =" submit "value =" Search "> </td> </tr> </form> </table>
Description of search syntax with multiple conditions in a search form

1. Multi-field parallel search: There are two transfer methods: "string" and "array"

The following is an example of string passing:

<Input type = "hidden" name = "hh" value = "LK"> <input type = "hidden" name = "show" value = "title, writer "> <input type =" hidden "name =" keyboard "value =" title, author ">

Note: The above fuzzy query title field contains the "title" character or writer field contains the "author" Information

The array is passed as an example:

<Input type = "hidden" name = "hh" value = "LK"> <input type = "hidden" name = "show []" value = "title"> <input type = "hidden" name = "keyboard []" value = "title"> <input type = "hidden" name = "show []" value = "writer"> <input type = "hidden" name = "keyboard []" value = "author">

The above fuzzy query results show that the title field contains the "title" character or the writer field contains the "author" information.

2. Search by multiple logical operators

The following is an example of string passing:

<Input type = "hidden" name = "hh" value = "LK, EQ"> <input type = "hidden" name = "show" value = "title, writer "> <input type =" hidden "name =" keyboard "value =" title, author ">

Note: The above fuzzy query title field contains "title" character or writer field is equal to "author" Information

The following is an example of string passing:

<Input type = "hidden" name = "show []" value = "title"> <input type = "hidden" name = "hh []" value = "LK"> <input type = "hidden" name = "keyboard []" value = "title"> <input type = "hidden" name = "show []" value = "writer"> <input type = "hidden" name = "hh []" value = "EQ"> <input type = "hidden" name = "keyboard []" value = "author">

Note: The above fuzzy query title field contains "title" character or writer field is equal to "author" information.

A practical example

The form is designed as follows:

<Form action = "[! -- News. url --] e/search/index. php "method =" post "name =" searchform "id =" searchform "> <select name =" classid "id =" "style =" display: none "> <option value =" 59,60, 78,79, 80, 81 "selected> all </option> </select> <input type =" hidden "name =" show "value =" title, myarea, mycategory, smalltext "/> <input type =" hidden "name =" tempid "value =" 1 "/> <table width =" 100% "cellspacing =" 0 "cellpadding =" 0" border = "0"> <tbody> <tr class = "even"> <td style = "text-align: left; "> region: <select name = "area" id = ""> <option value = ""> unlimited </option> <option value = "Xiangzhou"> Xiangzhou </option> <option value = ""> </option> <option value = "north"> Gongbei </option> <option value = ""> Xin Xiangzhou </option> <option value = "Qianshan"> Qianshan </option> <option value = "Nanping"> Nanping </option> <option value = "Jin Wan"> Jin Wan </option> <option value = "doumen"> doumen </option> </select> room type: <select name = "category" id = ""> <option value = ""> unlimited </option> <option value = "58_0"> Data Center 1 </option> <option value = "58_1"> two rooms </option> <option value = "58_2"> three or more rooms </option> <option value = "58_3"> apartment </option> <option value = "58_4"> office buildings </option> <option value = "58_5"> shops </option> <option value = "58_6"> Factory Buildings </option> </ select> </td> </tr> <tr class = "even"> <td style = "text-align: left; "> time range: <input name =" starttime "type =" text "value =" 2008-08-08 "size =" 12 "onclick =" calendar. show (this); "/> to <input type =" text "id =" todayButton "name =" todayButton "value =" "size =" 12 "onclick =" calendar. show (this); "/> (if this parameter is not selected, the time period is not limited) </td> </tr> <tr class = "even"> <td style = "text-align: left; "> <input name =" keyboard "type =" text "size =" 32 "value =" "id =" keyboard "class =" inputText "/> <input type =" submit "name =" Submit22 "value =" "/> </td> </tr> </tbody> </table> </ form>

To add a search for the custom fields myarea and mycategory, we need to modify e/search/index. php as follows:

$ Keyboard = $ _ POST ['keyboard']. ','. $ _ POST ['region']. ','. $ _ POST ['category ']; // this is the original: $ keyboard =$ _ POST ['keyboard']; $ keyboardone = 0; if (is_array ($ keyboard )) {} elseif (strstr ($ keyboard, ',') {$ keyboard = explode (',', $ keyboard);} else {$ keyboard = trim ($ keyboard ); $ len = strlen ($ keyboard); if ($ len <$ public_r [min_keyboard] | $ len> $ public_r [max_keyboard]) {printerror ("MinKeyboard", $ getfrom, 1) ;}$ keyboardone = 1 ;}

OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.