Empire CMS provides a relatively powerful search result call. You can create most of the search functions that meet your needs according to the empire cms search form creation syntax. If you have custom fields in your database, you may need to change the data processing of e/search/index.php for form submission. You can refer to the example provided at the end of the article. Let’s take a look at the search form variable description first:
Variable name | Description | Example |
Search form submission address | POST method: /e/search/index.php | |
GET method:/e/search/?searchget=1 | /e/search/?searchget=1&keyboard=Empire&show=title | |
keyboard | Search keyword variables | |
show | Search field variable (multiple fields are separated by ",". The search field must be the field where the background model enables search) | |
classid | Search column ID (if not set to unlimited, multiple columns can be opened with ",", setting the parent column will search all sub-columns) | |
ztid | Search topic ID (if not set to unlimited, multiple topics are available "," open) | |
tbname | Search by data table (needs to be combined with search template ID) | |
tempid | Search template ID used (generally used in conjunction with table search) | |
starttime and endtime | Respectively search for information about the start time and end time of publishing (if not filled in, there is no limit. Format: 2008-02-27) |
|
startprice and endprice | Respectively are the starting price and end price of the product price (if not filled in, there is no limit) |
|
Search special fields | id: Search by message ID keyboard: Search by keyword (can list information by tags) userid : Search by publisher user ID username: Search by publisher username |
|
member | If the value is 0, there is no limit A value of 1 means only searching for information submitted by members If the value is 2, only the information added by the administrator will be searched |
|
orderby | Sort field: 0: By release date (default) 1: Press ID 2: By number of comments 3: Click to browse popularity 4: According to the number of downloads |
|
myorder | Sort by: 0: Sort in reverse order (default) 1: Arrange in order |
|
andor | Set the association between multi-condition queries. There are two types: or: relationship between or (default) and : the relationship of and |
|
hh | Logical operation connector variable: 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 (search keywords separate each value with a space) BT: Range, between two values (search keywords separate two values with a space) LK: Fuzzy query (default) |
Here is an example:
<table width="320" border="0" cellspacing="1" cellpadding="3"> <form name="searchform" method="post" action="/e/search/index.php"> <tr> <td>关键字:<input name="keyboard" type="text" size="10"></td> <td>范围: <select name="show"> <option value="title">标题</option> <option value="smalltext">简介</option> <option value="newstext">内容</option> <option value="writer">作者</option> <option value="title,smalltext,newstext,writer">搜索全部</option> </select></td> </tr> <tr> <td>栏 目: <select name="classid"> <option value="0">搜索全部</option> <option value="1">新闻中心</option> <option value="4">技术文档</option> <option value="22">下载中心</option> </select> </td> <td><input type="submit" name="submit" value="搜索"></td> </tr> </form> </table>
Search form multi-condition parallel search syntax description
1. Multi-field parallel search: There are two transmission methods: "string" and "array"
String passing as 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 for information that the title field contains the "title" character or the writer field contains "author"
Array passing as 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="作者">
The above is a fuzzy query for information that the title field contains the "title" character or the writer field contains "author"
2. Parallel search of multiple logical operation connectors
String passing as example:
<input type="hidden" name="hh" value="LK,EQ"> <input type="hidden" name="show" value="title,writer"> <input type="hidden" name="keyboard" value="标题,作者">
Explanation: The above is a fuzzy query for information that the title field contains the "title" character or the writer field is equal to "author"
String passing as example:
<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="作者">
Explanation: The above is a fuzzy query for information that the title field contains the "title" character or the writer field is equal to "author".
A practical example
The form design is 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>全部</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;">地区: <select name="area" id=""> <option value="">不限</option> <option value="香洲">香洲</option> <option value="吉大">吉大</option> <option value="拱北">拱北</option> <option value="新香洲">新香洲</option> <option value="前山">前山</option> <option value="南屏">南屏</option> <option value="金湾">金湾</option> <option value="斗门">斗门</option> </select> 房型: <select name="category" id=""> <option value="">不限</option> <option value="58_0">一房</option> <option value="58_1">二房</option> <option value="58_2">三房以上</option> <option value="58_3">公寓</option> <option value="58_4">写字楼</option> <option value="58_5">商铺</option> <option value="58_6">厂房</option> </select> </td> <td> </td> </tr> <tr class="even"> <td style=" text-align:left;">时间范围: <input name="starttime" type="text" value="2008-08-08" size="12" onclick="calendar.show(this);" /> 到 <input type="text" id="todayButton" name="todayButton" value="" size="12" onclick="calendar.show(this);" /> (不选则不限时段)</td> <td> </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> <td></td> </tr> </tbody> </table> </form>
In order to add the search for the custom fields myarea and mycategory, we need to rewrite e/search/index.php appropriately:
$keyboard=$_POST['keyboard'].','.$_POST['area'].','.$_POST['category']; // 这是原来的:$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, done.

PHPisusedforsendingemailsduetoitsintegrationwithservermailservicesandexternalSMTPproviders,automatingnotificationsandmarketingcampaigns.1)SetupyourPHPenvironmentwithawebserverandPHP,ensuringthemailfunctionisenabled.2)UseabasicscriptwithPHP'smailfunct

The best way to send emails is to use the PHPMailer library. 1) Using the mail() function is simple but unreliable, which may cause emails to enter spam or cannot be delivered. 2) PHPMailer provides better control and reliability, and supports HTML mail, attachments and SMTP authentication. 3) Make sure SMTP settings are configured correctly and encryption (such as STARTTLS or SSL/TLS) is used to enhance security. 4) For large amounts of emails, consider using a mail queue system to optimize performance.

CustomheadersandadvancedfeaturesinPHPemailenhancefunctionalityandreliability.1)Customheadersaddmetadatafortrackingandcategorization.2)HTMLemailsallowformattingandinteractivity.3)AttachmentscanbesentusinglibrarieslikePHPMailer.4)SMTPauthenticationimpr

Sending mail using PHP and SMTP can be achieved through the PHPMailer library. 1) Install and configure PHPMailer, 2) Set SMTP server details, 3) Define the email content, 4) Send emails and handle errors. Use this method to ensure the reliability and security of emails.

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

The reason for using Dependency Injection (DI) is that it promotes loose coupling, testability, and maintainability of the code. 1) Use constructor to inject dependencies, 2) Avoid using service locators, 3) Use dependency injection containers to manage dependencies, 4) Improve testability through injecting dependencies, 5) Avoid over-injection dependencies, 6) Consider the impact of DI on performance.

PHPperformancetuningiscrucialbecauseitenhancesspeedandefficiency,whicharevitalforwebapplications.1)CachingwithAPCureducesdatabaseloadandimprovesresponsetimes.2)Optimizingdatabasequeriesbyselectingnecessarycolumnsandusingindexingspeedsupdataretrieval.

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
