This article mainly introduced about five smarty in the variable modifier and function description, has a certain reference value, now share to everyone, the need for friends can refer to
Default
For example: {$arr |default: ' xxxx '}, default variable adjuster, displays the given default value when the variable is empty, sets a default value for the null variable, and replaces the output with the given default value when the variable is empty or unassigned.
Truncate
For example: {$articleTitle |truncate:10}, the length of the cut string is the specified length, and the character of a length is truncated from the beginning of the string, which is 80 by default.
Count_characters
For example: {$articleTitle |count_characters}, gets the length of the string, calculates the number of characters in the variable value, and the parameter value the Brown type determines whether the number of spaces is calculated, and no space is calculated by default.
Strip_tags
For example: {$articleTitle |strip_tags}, remove all HTML tags from the string;
Date_format
For example: {$smarty. Now|date_format (")}, format timestamp, date format, first parameter control date format, if the data passed to Date_format is empty, the second parameter will be used as the default time.