Phpcms Call Form Class editor editor function to upload picture attachments dynamically

Source: Internet
Author: User

Http://w3note.com/web/49.html

phpcms V9 's System class library has a form class that encapsulates some components of the form, such as editors, picture uploads, time selectors, template selectors, and more, refer to form.class.php. With these components, it is more time-saving and hassle-phpcms to develop the V9 two times. All we have to do is pull these tools out and use them. There are a total of two methods of calling.

First, the view call method
This method is the simplest, but has limitations. When a model in the background defines a field, the type of the form is selected to generate the corresponding form type.


Second, code call method
This method is more flexible, out of the Content module constraints, no longer adhere to the framework of the content model. Here is a football module controller to add information to the method, see the code:
Form Class Location: libs\classes--form.class.php

01 Public functionAddfbteam () {02$levels=$this->level->select (', ', ' id ', ' Level ', ' ', ' id ')); 03if(isset($_post[' Dosubmit '])){ 04$_post[' Football '] =$this->check ($_post[' Football ']); 05if($this->db->insert ($_post[' Football '])) ShowMessage (L (' operation_success '), '? M=football&c=admin_fbteam&a=fblists '); 06}Else{ Pc_base::load_sys_class (' form ', ', 0); 08include $this->ADMIN_TPL (' Fbteam_add '); 09                  } 10}

Description: Pc_base::load_sys_class (' form ', ' 0 '), load Form class form.class.php, ' empty parameter ' represents the path to the class file, load the class inside the System class library, and the parameter ' 0 ' means that the class is not instantiated.

The template view for the above method

<TR><thwidth= "a"><Strong><?php echo L (' Football_profile ')?>:</Strong></th><TD><textareaname= "Football[profile]"ID= "Profile"></textarea><?php echo form::editor (' profile ');?></TD></TR>

Description: "Form::editor (' profile ')", which loads the form class and is not instantiated, is intended to use the static method call editor, where the parameter "profile" represents the ID of the form.

This is only called the Form class editor call, the other table monotone method similar, regardless of what form is called, first of all to load the System class library form class, and then in the template Call Form class form method, such as timesheet, form::d ate (' football[formed] ', date (' Y-m-d '), 0), picture upload form::images (' football[badge] ', ' badge ', ' &nbsp; ', ' Football ').

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.