Dedecms common function parsing. As we all know, dedecms supports some usage such as [field: senddatefunction "strftime (% y-% m-% d % H: % M, @ me, that is, the function is used in the tag. it is known that dedecms supports [field: senddate function = "strftime ('% y-% m-% d % H: % M', @ me) "/] is used to call related functions to re-process the content returned by the current tag and 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)"/]
Usage ('% y-% m-% d % H: % M', @ me) "/], that is, using function in tag, call the relevant function to return the current tag...