Phpcms implements Verification Code replacement and phpcms implements full-site search.

Source: Internet
Author: User

Phpcms implements Verification Code replacement and phpcms implements full-site search.

When you use phpcms to replace a webpage, in addition to the normal replacement of columns, content pages, and so on, what other verification codes are provided, the form is submitted, and the search function is now available, these may slightly change some default files during replacement.

The following is the process of successful failure, and finally replaced with a bug-free replacement.

I. phpcms Verification Code replacement

If there is a verification code, it is generally a form. First, you must create a form. The process of creating a form is very simple, as shown below:

A. Create a form

(1) log on to your phpcms background management

(2) After logging in, follow this step to add a form

A. Module ------ Form Wizard:

B. Open the Form Wizard and click "add Form Wizard,

C. Open the dialog box to add information and click OK.

D. After confirmation, the newly added form will appear in this window,

(3) add fields to the form

A. Click the "add field" button on the current page to open the "add field" window.

B. Add information in the add field window (set each field in the window, such as the field type, length, field name, and so on)

C. Click Submit. The field is successfully added. view all the fields you have added.

Click "manage fields" to view information about all the added fields.

D. In this way, the form will be available. Add the form to the replaced webpage, and you only need to copy this js sentence,

Copy this sentence to the corresponding location on the webpage.

Now the form is available. You can view the form style and click "preview ".

(3) modify the start information of a form

After a webpage is added normally, such a style will appear,

A. Open the default template folder of your phpcms template,

B .open the corresponding folder and find the corresponding show_js.html file in the folder formguidemo-folder to open the file,

C.modify the location in the opened show_js.html file,

In this case, the form is actually over.

B. Add verification code to form

(1) Add a field name "Verification Code". This step is provided above and will not be detailed.

(2) Find the corresponding show_js.html file in the formguidemo-folder and open the file.

Add such a piece of code at this location,

The added code is as follows:

(3) After the files in the default template are modified, You need to modify the index. php file under \ modules \ formguide,

To find this folder, it also exists in the phpcms folder.

Open the file and add such a code to add a location

The added code is as follows:

In this way, the verification code is complete and displayed:

You can click an image to modify the verification code.

Through continuous attempts, This is the complete process for replacing the verification code ~~~~

To view the form submitted by the user, you can view the following information:

On the right of each form, click "Information List ":

In the information list, you can view the content submitted by the users who have added the form,

2. phpcms enables full-Site Search

The so-called Full-site search function is actually a website search based on the input content.

Step 1: Search for the form on the page and submit and write the form.

In this way, the desired content is passed into the index. php file for processing (the index. php file is in modules/search/index. php). This php file is used to judge and process the input values.

:

Step 2: The page returned by this form

The returned page is not a column page, a list page, or a content page. It is an independent file.

(1) create a search folder under your own template: Path:

It is not created in the content file, but it is created outside the search folder

(2) There are several files in the search folder (split the returned page)

Split a whole static page into four page files, such as header, footer, index, and list.

(3) Display Search Results

The split is not much said. I know that all phpcms will be split. Now I want to modify the index and list pages.

The index page is returned when no content is found. You can set this page by yourself or use the default page of phpcms.

The list page is the result page of the search. Note: In addition to the content to be displayed, do not traverse other content, this will cause an error in the search results and will not display the search results.

The traversal code for displaying the search result page is as follows: (place this code to the desired position and modify the style according to your own style)

Note: You can go to the default phpcms template to view how to write files in the search folder. Note that several js files need to be imported and cannot be written.

Step 3: perform inspection

Check whether the page of the result is correct:

(1) products with "gas" in the search site

(2) check whether the page has come out (there should be pagination for many things, and the keywords for search are highlighted. This is the style modification)

Here, the replacement of phpcms's full-site search is over.

Notes:

(1) The search folder is a file at the same level as the template content.

(2) files in the search folder must also be split into "header, center, and bottom"

(3) All the files to be split, except the search results, cannot traverse any search database.

Summary

The above section describes how to replace the phpcms verification code and phpcms to implement the full-site search function. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.