PHPCMS Web page Replacement verification code function and search function

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 process of success in failure, and finally replaced by a bug-free replacement. Yue ~

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:

12345678910111213 <tr>    <thstyle=" border:0px;">        <fontcolor="red">*</font>验证码:    </th>    <tdstyle=" border:0px;">    <inputname="code" type="text" id="code" size="10"  class="input-text" style="width:492px;"/></td></tr><tr>    <thstyle=" border:0px;"></th>    <tdstyle=" border:0px;">        <imgid=‘code_img‘ onclick=‘this.src=this.src+"&"+Math.random()‘  src=‘{APP_PATH}api.php?op=checkcode&code_len=4&font_size=14&width=110&height=30&font_color=&background=‘ width="201" height="50">    </td></tr>

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

1 $session_storage‘session_‘.pc_base::load_config(‘system‘,‘session_storage‘); pc_base::load_sys_class($session_storage);

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, 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.

<form name= "search" id= "" action= "{app_path}index.php" method= "Get" style= " 170px; Display:inline-block; Float:left "> 

  

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)

<ul>      {loop $data $i $r}                                 {if $r [' Thumb ']}  <!--search results picture--      <li><b><a href= "{$r [url]}" ></a></b><!--search result picture and path---      {/if}      

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.

{if $setting [' suggestenable ']}<script type= ' text/javascript ' src= ' {js_path}jquery.suggest.js ' ></script ><script type= "Text/javascript" src= "{js_path}search_suggest.js" ></script>{/if}

  

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.

This is the PHPCMS replacement process encountered problems are all done, wow plug have to say this whole station search made my dizzy, fortunately completed, now is to share the steps to everyone ~ ~ ~

PHPCMS Web page Replacement verification code function and search function

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.