About the meaning of the Pc_tag () method in module _tag.class.php in Phpcms

Source: Internet
Author: User

About the meaning of the Pc_tag () method in module _tag.class.php in Phpcms:
        Write your own backend module in PHPCMS system, To be displayed in the foreground template, you need to write a "module name _tag.class.php" file in the module name \classes\ directory that you define in \phpcms\modules\, which outputs the custom PC label used by the front module board, Tags define how the methods in the class are written I will not go into the details here, because a lot of relevant content on the Internet, such as: (Http://wenku.baidu.com/link?url= SESC6ZSIC5BJI6LYBI9ZP2ZMUPZOS8ZV-PC07SEOWVDISWVJMWRN098PXNFO7XSAMKL94LMSYS-L3DC2EYR2SIRA_VXUCI1HW4CRASV7CPE), In the Foreground tab in addition to the use of some of their own definition of the label can also use \phpcms\libs\functions\global.func.php this file defined methods, interested can see (http://blog.csdn.net/ qzmrock/article/details/7716772) very well to find. I'll talk about it here. This tag defines the role of the Pc_tag () method in the class file. Because I found that this aspect of the information is very small, even on the PHPCMS official website has asked but did not give the answer. I also studied for 2 days to figure out what this method is for, write it out and share it with you, hoping to help you.
You can see that all of the "module _tag.class.php" file has a Pc_tag () method, which says "label generation method," the words of the note, this method is what exactly? In fact, this method is to provide an array of parameters and parameter values defined in this array to provide data to the system Template Management, Label Wizard, Tagging Wizard. Clicking on the "Add Label Wizard" will bring up the wizard dialog, and in the "Select Model" drop-down box there are all the modules that are installed in the system, which are the data obtained from the array in the \phpcms\caches\configs\modules.php file, and if you add the last line in the array ' Your own definition of the module ' + ' module name, so you can find your own definition of the module name in the drop-down box, this time select the module, if the system in \phpcms\phpcms\modules\ itself defined module \classes directory can not find " Self-defined module _tag.class.php "file, the system will automatically exit the browser error, if the file is defined, the system will automatically load the Pc_tag () method provided in the array data, the following section of the data as an example analysis:
return arrary (' Action ' =>array (' type_list ' =>l (' guestbook_list ', ' ', ' Guestbook ')),
' type_list ' =>array (
' SiteID ' =>array (' name ' =>l (' site_id ', ' ', ' comment '), ' htmltype ' = ' input_select ', ' data ' = $sitelist,)
........
                                      ),
);
You can see that the Pc_tag () method returns an array in which each variable array represents a line of content in the Label Wizard dialog box. For example, ' Action ' =>array (' type_list ' =>l (' guestbook_list ', ' ', ' Guestbook '), the next row in the drop-down box of the "Select Model" in the wizard dialog box displays "Select Action:" Guestbook_list This line of content, here the guestbook_list is a radio box label if the \phpcms\phpcms\languages\zh-cn\ The guestbook.lang.php file defines the guestbook_list of the Chinese character tags such as "message board List", then the "Select operation:" After the "Message board list" The words of the label, the array has a few items then the operation will have a few labels display, If the tag is selected then it will then read the parameters in the array variable, such as selecting the Guestbook_list tag, then it will read the data in the Type_list array.
' type_list ' =>array (
' SiteID ' =>array (' name ' =>l (' site_id ', ' ', ' comment '), ' htmltype ' = ' input_s ' Elect ', ' data ' = $sitelist,)
Another line in the dialog box (Label: Text Box selection dropdown box) corresponds to the array (L (' site_id ', ' ', ' comment '): input Select) Here the site_id is the site defined in the comment.lang.php file. The value of the _id parameter, and the value of the drop-down box is the value in data.


As you can see here, Pc_tag () method is the system in the Operation page for the foreground panel to provide a way to add tags, if you do not need the user to add custom new module tags in the _tag.class.php file does not have to define the Pc_tag () method, This has no effect on the display of the foreground template.


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.