Dede Dream CMS System How to add a custom label method function

Source: Internet
Author: User


In the dream label, sometimes some system-written tools are used, such as GETDATETIMEMK (@me) formatting time and Cn_substr (@me, 50) intercept strings, and so on, how to customize a tool method, open the directory \include\helpers folder, this helpers under the File name. helper.php named files are tags of the tool method file, has been in the writing template before the loading, we pick one of the files, such as string.helper.php file open to modify, at the bottom of the set up by the sign bit back to pass the method, such as:

/**
 *  Returns a string determined by the flag bit *
 * @param     int    $flag  flag bit
 * @return    string
/if ( ! Function_exists (' Getstrreport '))
{
    function getstrreport ($flag)
    {
        if ($flag ==0) {
           return ' Normal ';  
		}
		if ($flag ==1) {return
           ' canceled ';}}}

After you save it, you can use this custom tag tool method in your template development, such as:

<TD width= "15%" >
Status: {Dede:field.report function= "Getstrreport (@me)"/}
</td>


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.