Phpcms V9 Single page Add a custom field

Source: Internet
Author: User

Speaking of the article custom from the paragraph, everyone will think of WordPress custom field, indeed WordPress system is very powerful, the field can be very flexible in the background to add and update, and can be very good in the foreground to call, for this point phpcms v9 a bit weak explosion, Phpcms V9 There is no custom field for this function, only we have to do two times development.

Phpcms v9 article content Add and update options have been many, basically tend to improve, and about Phpcms V9 single page is very simple, using only three fields: title, keywords, content, which is often not enough to use, sometimes need to add more options, than tablets, or text description, etc., The following summer blog mainly for everyone to talk about Phpcms v9 How to add custom fields to a single page.

1. Give a single page custom summary

The first step is to open the database and find the V9_page data table to add a Description field, with a field type of varchar and a length of 255.

In the second step, open the phpcms\modules\content\templates\content_page.tpl.php file and go to the following code:

<tr><th width= "" > <?php echo L (' content '); Add:<tr>      <th width= "></th><td>//" > Content introduction </th>      <td><textarea Type= "text" Name= "info[description]"  style= ' width:98%;height:46px; ' ><?php Echo $description?></textarea> can only input <b><span id= "Description_len" >255</span ></B> characters  </td>    </tr>

After the change is complete, we also need to update the background cache, and then make a single page of editing, this time there will be the field of the article summary, the foreground only need to make a call {$description} on it.

Second, to the page to customize the picture field, convenient image upload.

The above has been described how to add a text field to a single page, here again how to add a picture of a single page field, and can be uploaded pictures.

1, also open the MySQL database, find the V9_page table, open the table structure and add a picture of the field: catpic type varchar, length 100, of course, can not be set.

2. Open the phpcms\modules\content\templates\content_page.tpl.php file and insert the following code below line 48:

<tr><th width= "80″> column image </th><td><?php Echo form::images (' info[catpic] ', ' image ', $catpic , ' content ');? ></td></tr>

After the change, the background cache updates, and then a single page to add or edit the time you can see our custom Upload image field, in the foreground call code {$CATPIC}, directly in the page.html template call.

Phpcms V9 Single page Add a custom field

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.