Dedecms Common function parsing _php techniques

Source: Internet
Author: User
As we all know, DEDECMS supports some uses of [Field:senddate function= strftime ('%y-%m-%d%h:%m ', @me) '/], that is, using function within the tag, Call the related function to process the contents returned by the current tag again and show it again.

Take the above mark as an example, originally the program shows a table of the database field senddate, but by looking at the database, Senddate is just a bunch of numbers, not the time format we want, the PHP language itself on time processing is some of its own functions, Strftime is the function of PHP itself, of course, you can also expand, write your own function, the template we do not need to display these numbers, we need to be in a certain format to our time, we can use this function for processing.


Below we will analyze the use of some common functions of dedecms:

Getcururl ()

This estimate does not use too much, this function obtains the current running script address, when can use in the following way:
{dede:cururl runphp= ' yes '}
@me = Getcururl ();
{/dede:cururl}

Getalabnum ()

To return a half-width number, you can use this function if you have a field information that you do not want to appear in full-width digits, such as:
[field:listnum/] Returns 12234, and I want to be a half-width number 12234, so you can use the function:
[Field:listnum function= "Getalabnum (@me)"/]

Text2html ()

Text to HTML, the function of the text content in the space, <, ... Such characters are converted to HTML tags and can be used in this way:
[Field:textcontent function= "text2html (@me)"/]
Also here is an inverse function that converts HTML to text, Html2text (), and uses similar

Clearhtml ()

Clears the HTML tag, and the function clears the HTML tags contained in the content. Usage:
[Field:content function= "clearhtml (@me)"/]

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.