4 common functions of weaving dream dedecms in detail

Source: Internet
Author: User
Tags html to text php language
This article mainly introduces the 4 common functions of weaving dream dedecms, this paper introduces the function and use method of 3 common functions such as Getcururl (), Getalabnum (), text2html (), clearhtml (), and so on, the need of friends can refer to

As you all know, Dedecms supports some usages of [Field:senddate function= "strftime ('%y-%m-%d%h:%m ', @me)"/], that is, the use of function within the tag, Call the relevant function to re-process the contents returned by the current label and display it again.

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

Dedecms template Download Address: www.php.cn/xiazai/code/dedecms

Let's analyze the use of some common functions of dedecms:

Getcururl ()

This estimate does not use too much, this function obtains the currently running script address, can use in the following way:

The code is as follows:

{dede:cururl runphp= ' yes '} @me = Getcururl (); {/dede:cururl}

Getalabnum ()

To return half-width numbers, you can use this function if you do not want the full-width number of a field information, for example:
[field:listnum/] returned is 12234, I would like to be the half-width of the number 12234, you can use the function:

The code is as follows:

[Field:listnum function= "Getalabnum (@me)"/]

Text2html ()

Text to HTML, function will be the text content of space, <, ... and other characters into HTML tags, you can use this:

The code is as follows:

[Field:textcontent function= "text2html (@me)"/]

Also here is an inverse function, which converts HTML to text, Html2text (), which uses a similar

Clearhtml ()

Clears the HTML tag, and the function clears the HTML markup contained in the content. Usage:

The code is as follows:

[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.