PHPCMS implementation of verification code replacement and full-site search Function Example detailed

Source: Internet
Author: User
In the use of PHPCMS to replace the page, in addition to the normal replacement columns, content pages, and other verification code, submit the form, search function, these may be replaced by some of the default files have some minor changes

The following is the success of their own in the process of failure, and finally replaced by the replacement of no bug, this article mainly introduces the PHPCMS verification code replacement and PHPCMS to achieve full-site search function, the need for friends can refer to, hope to help everyone.

One, phpcms the verification code replacement

There is a verification code place, is generally the form, then the first to make a form out, the form of the production process is very simple, as follows:

A. Make a form.

(1) Login to your PHPCMS admin

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

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

B. After you open the Form Wizard, click the Add Form Wizard button,

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

D. Make sure that the form you just added will appear in this window,

(3) Adding 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 one in the window, such as field type, length, field name, etc.)

C. Once you click Submit, the field is added successfully to see all the fields you have added

Click Manage fields to view all the field information you have added

D. So the form has, add the form to the replacement page, as long as the copy of the sentence JS can be,

Copy this sentence to the corresponding location on the page.

Here is the form, you can look at the style of the form, click the "Preview" button to

(3) Modify the opening information of the form

After the normal add to the Web page, there will be a style,

A. Open the default template folder for your own phpcms template,

B. Open the default folder, locate the "show_js.html" file in the "Formguide" folder, open the file,

C. In the open show_js.html file, modify the location,

In that case, the form is really over.

B. Add a verification code to the form

(1) Add a field name "Verification Code", this step is above, unknown

(2) The same in the default folder, locate the "show_js.html" file in the "Formguide" folder, open the file

Add such a piece of code at this location,

Add the following code, as follows:

(3) After the modification of the file in the default template, it is necessary to modify one place, that is, change the index.php file under \modules\formguide,

To find this folder, the same is true in the Phpcms folder

Open the file and add a code like this to add a location

Add the following code, as follows:

In this way, the verification code is completed, showing:

Clicking on the image also allows you to modify the contents of the verification code.

Through constant attempts, this is the complete step to replace the verification code ~ ~ ~

To view a user-submitted form, you can view this place:

To the right of each form, click Info list:

Go to the information list to see who has added the form and what is being submitted,

Second, Phpcms realize the whole station search function

The so-called full-site search function, in fact, is based on the input content of the site search.

The first step: the Search page Form form submission writing, form form how to write not much to say.

This will be the content you want to find into the index.php file for processing (index.php file in modules/search/index.php) This PHP file is the above-mentioned types of values to judge and processing

Step two: The page returned by this form form

The return value of the page is not a column page, nor a list page, or a content page, is a separate file

(1) Create a Search folder under your own template: path such as:

Not built in the content file, but it's outside the build Search Folder

(2) The Search Folder has so many files (its own return page to be split)

Split a whole static page like other pages into a few parts: header, footer, index, list so 4 paging files

(3) Display of search results

Split is not much to say, know Phpcms will split, now is the index page and the list page to modify

The index page is to search for pages that are returned without content, which can be set by itself or by using Phpcms's default page.

The list page is the result of the search page, remind: this page in addition to display the content of the search, the other content will not be traversed to display, because this will be the results of the search error, will not show the results of the search.

The traversal code that displays the search results page is as follows: (Put this in the position you want to display, and the style changes according to your own style)

Note: You can go in phpcms Default template to view the files in the Search Folder how to write, note that there are several JS files need to be introduced, cannot write.

Step three: Conduct inspection

Check the results page for any questions:

(1) Products with "gas" inside the search station

(2) Check whether the page is out (there should be a lot of pages, there are keywords to search for highlighting, this is the modification of the style)

The replacement of the full-site search phpcms here is over.

Points to note:

(1) Search Folder is the same level file in template content

(2) The files in the Search Folder are also split into "head, middle, and bottom"

(3) All the files in the split will not have any traversal of the lookup database except for the search results.

Related Article

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.