We all know that Dedecms supports [field: senddate function = "strftime ('% y-% m-% d % H: % M', @ me) "/] in this way, you can use the function in the tag to call the relevant function to re-process the content returned by the current tag and then display it.
Take the above mark as an example. The program originally showed the field senddate of a table in the database. However, by viewing the database, we found that senddate is only a large string of numbers, not the desired time format, the PHP language itself has some built-in functions for time processing. strftime is the built-in function of php itself. of course, you can also extend it and write your own functions, we do not need to display these numbers in the template. we need to convert them to our time in a certain format. in this case, we can use this function for processing.
Next we will analyze how dedecms comes with some common functions:
■ GetCurUrl ()
This estimate is not used too much. this function obtains the currently running script address, which can be used in the following ways:
{Dede: CurUrl runphp = 'yes '}
@ Me = GetCurUrl ();
{/Dede: CurUrl}
■ GetAlabNum ()
Returns a half-width number. if you do not want a full-width number in a field, you can use this function. for example:
[Field: listnum/] the returned value is 12234. I want to use the half-width number 12234. you can use the function as follows:
[Field: listnum function = "GetAlabNum (@ me)"/]
■ Text2Html ()
Convert text to HTML. the Function converts spaces, <,>... Can be used as follows:
[Field: textcontent function = "Text2Html (@ me)"/]
There is also an opposite function here, which converts html to Text, Html2Text (), and its usage is similar
■ ClearHtml ()
Clear the html tag. the Function clears the html tag contained in the content. Usage:
[Field: content function = "ClearHtml (@ me)"/]
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