diff --git a/docs/en/designers/language-modifiers.xml b/docs/en/designers/language-modifiers.xml
index cedff100..3473afe4 100644
--- a/docs/en/designers/language-modifiers.xml
+++ b/docs/en/designers/language-modifiers.xml
@@ -1,17 +1,17 @@
-
- Variable Modifiers
-
- Variable modifiers can be applied to variables, custom functions or strings. To
- apply a modifier, specify the value followed by the |
- (pipe) and the modifier name. A modifier may accept additional parameters
- that affect its behavior. These parameters follow the modifer name and are
- separated by : (colon).
-
-
- modifier example
-
+
+ Variable Modifiers
+
+ Variable modifiers can be applied to variables, custom functions or strings. To
+ apply a modifier, specify the value followed by the |
+ (pipe) and the modifier name. A modifier may accept additional parameters
+ that affect its behavior. These parameters follow the modifer name and are
+ separated by : (colon).
+
+
+ modifier example
+
{$title|upper}
@@ -24,47 +24,47 @@ Topic: {$topic|truncate:40:"..."}
{* apply modifier to a custom function *}
{mailto|upper address="me@domain.dom"}
+r
]]>
-
-
-
- If you apply a modifier to an array variable instead of a single value variable,
- the modifier will be applied to every value in that array. If you really want
- the modifier to work on an entire array as a value, you must prepend the
- modifier name with an @ symbol like so:
- {$articleTitle|@count} (this will print out the number of
- elements in the $articleTitle array.)
-
-
- Modifiers can be autoloaded from your $plugins_dir (also see:
- Naming
- Conventions) or can be registered explicitely (see: register_modifier). Additionally
- all php-functions can be used as modifiers implicitly. (The
- @count-example above actually uses php's
- count-function and not a smarty-modifier). Using php-functions
- as modifiers has two little pitfalls: First: Sometimes the order
- of the function-parameters is not the desirable one
- ({"%2.f"|sprintf:$float} actually works, but
- asks for the more intuitive {For example:
- $float|string_format:"%2.f"} that is provided by the
- Smarty distribution). Second: with $security turned on all
- php-functions that are to be used as modifiers have to be
- declared trusted in the
- $security_settings['MODIFIER_FUNCS']-array.
-
+
+
+
+ If you apply a modifier to an array variable instead of a single value variable,
+ the modifier will be applied to every value in that array. If you really want
+ the modifier to work on an entire array as a value, you must prepend the
+ modifier name with an @ symbol like so:
+ {$articleTitle|@count} (this will print out the number of
+ elements in the $articleTitle array.)
+
+
+ Modifiers can be autoloaded from your $plugins_dir (also see:
+ Naming
+ Conventions) or can be registered explicitely (see: register_modifier). Additionally
+ all php-functions can be used as modifiers implicitly. (The
+ @count-example above actually uses php's
+ count-function and not a smarty-modifier). Using php-functions
+ as modifiers has two little pitfalls: First: Sometimes the order
+ of the function-parameters is not the desirable one
+ ({"%2.f"|sprintf:$float} actually works, but
+ asks for the more intuitive {For example:
+ $float|string_format:"%2.f"} that is provided by the
+ Smarty distribution). Second: with $security turned on all
+ php-functions that are to be used as modifiers have to be
+ declared trusted in the
+ $security_settings['MODIFIER_FUNCS']-array.
+
-
- capitalize
-
- This is used to capitalize the first letter of all words in a variable.
-
-
- capitalize
-
+
+ capitalize
+
+ This is used to capitalize the first letter of all words in a variable.
+
+
+ capitalize
+
display('index.tpl');
?>
]]>
-
-
- Where index.tpl is:
-
-
+
+
+ Where index.tpl is:
+
+
-
-
- This will output:
-
-
+
+
+ This will output:
+
+
-
-
-
-
- count_characters
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- boolean
- No
- false
- This determines whether or not to include
- whitespace characters in the count.
-
-
-
-
-
- This is used to count the number of characters in a variable.
-
-
- count_characters
-
+
+
+
+
+ count_characters
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ boolean
+ No
+ false
+ This determines whether or not to include
+ whitespace characters in the count.
+
+
+
+
+
+ This is used to count the number of characters in a variable.
+
+
+ count_characters
+
display('index.tpl');
?>
]]>
-
-
- Where index.tpl is:
-
-
+
+
+ Where index.tpl is:
+
+
-
-
- This will output:
-
-
+
+
+ This will output:
+
+
-
-
-
-
- cat
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- cat
- Description
-
-
-
-
- 1
- string
- No
- empty
- This value to catentate to the given variable.
-
-
-
-
-
- This value is concatenated to the given variable.
-
-
-cat
-
-index.php:
-
+
+
+
+
+ cat
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ cat
+ Description
+
+
+
+
+ 1
+ string
+ No
+ empty
+ This value to catentate to the given variable.
+
+
+
+
+
+ This value is concatenated to the given variable.
+
+
+ cat
+
+assign('articleTitle', "Psychics predict world didn't end");
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+ Where index.tpl is:
+
+
+
-
-
-
- count_paragraphs
-
- This is used to count the number of paragraphs in a variable.
-
-
-count_paragraphs
-
-index.php:
-
+]]>
+
+
+ This will output:
+
+
+
+
+
+
+
+ count_paragraphs
+
+ This is used to count the number of paragraphs in a variable.
+
+
+ count_paragraphs
+
+assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+ Where index.tpl is:
+
+
+
+
+
+ This will output:
+
+
+
-
-
-
- count_sentences
-
- This is used to count the number of sentences in a variable.
-
-
-count_sentences
-
-index.php:
-
+2
+]]>
+
+
+
+
+ count_sentences
+
+ This is used to count the number of sentences in a variable.
+
+
+ count_sentences
+
+assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+ Where index.tpl is:
+
+
+
+
+
+ This will output:
+
+
+
-
-
-
- count_words
-
- This is used to count the number of words in a variable.
-
-
-count_words
-
-index.php:
-
+2
+]]>
+
+
+
+
+ count_words
+
+ This is used to count the number of words in a variable.
+
+
+ count_words
+
+assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
+$smarty->display('index.tpl');
+?>
+]]>
+
+
+ Where index.tpl is:
+
+
+
+
+
+ This will output:
+
+
+
-
-
-
- date_format
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- string
- No
- %b %e, %Y
- This is the format for the outputted date.
-
-
- 2
- string
- No
- n/a
- This is the default date if the input is empty.
-
-
-
-
-
- This formats a date and time into the given strftime() format.
- Dates can be passed to Smarty as unix timestamps, mysql timestamps
- or any string made up of month day year (parsable by strtotime).
- Designers can then use date_format to have complete control of the
- formatting of the date. If the date passed to date_format is empty
- and a second parameter is passed, that will be used as the date to
- format.
-
-
-date_format
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('yesterday', strtotime('-1 day'));
-$smarty->display('index.tpl');
-
-index.tpl:
-
-
-{$smarty.now|date_format}
-{$smarty.now|date_format:"%A, %B %e, %Y"}
-{$smarty.now|date_format:"%H:%M:%S"}
-{$yesterday|date_format}
-{$yesterday|date_format:"%A, %B %e, %Y"}
-{$yesterday|date_format:"%H:%M:%S"}
-
-OUTPUT:
-
-Feb 6, 2001
-Tuesday, February 6, 2001
-14:33:00
-Feb 5, 2001
-Monday, February 5, 2001
-14:33:00
-
-
-date_format conversion specifiers:
-
-
-%a - abbreviated weekday name according to the current locale
-
-
-%A - full weekday name according to the current locale
-
-
-%b - abbreviated month name according to the current locale
-
-
-%B - full month name according to the current locale
-
-
-%c - preferred date and time representation for the current locale
-
-
-%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
-
-
-%d - day of the month as a decimal number (range 00 to 31)
-
-
-%D - same as %m/%d/%y
-
-
-%e - day of the month as a decimal number, a single digit is preceded by a space (range 1 to 31)
-
-
-%g - Week-based year within century [00,99]
-
-
-%G - Week-based year, including the century [0000,9999]
-
-
-%h - same as %b
-
-
-%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
-
-
-%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
-
-
-%j - day of the year as a decimal number (range 001 to 366)
-
-
-%k - Hour (24-hour clock) single digits are preceded by a blank. (range 0 to 23)
-
-
-%l - hour as a decimal number using a 12-hour clock, single digits preceeded by a space (range 1 to 12)
-
-
-%m - month as a decimal number (range 01 to 12)
-
-
-%M - minute as a decimal number
-
-
-%n - newline character
-
-
-%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale
-
-
-%r - time in a.m. and p.m. notation
-
-
-%R - time in 24 hour notation
-
-
-%S - second as a decimal number
-
-
-%t - tab character
-
-
-%T - current time, equal to %H:%M:%S
-
-
-%u - weekday as a decimal number [1,7], with 1 representing Monday
-
-
-%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
-
-
-%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
-
-
-%w - day of the week as a decimal, Sunday being 0
-
-
-%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
-
-
-%x - preferred date representation for the current locale without the time
-
-
-%X - preferred time representation for the current locale without the date
-
-
-%y - year as a decimal number without a century (range 00 to 99)
-
-
-%Y - year as a decimal number including the century
-
-
-%Z - time zone or name or abbreviation
-
-
-%% - a literal `%' character
-
-
-
- Programmers note
-
- date_format is essentially a wrapper to PHP's strftime()
- function. You may have more or less conversion specifiers available depending
- on your system's strftime() function where PHP was compiled. Check your
- system's manpage for a full list of valid specifiers.
-
-
-
-
-
-
- default
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- string
- No
- empty
- This is the default value to output if the
- variable is empty.
-
-
-
-
-
- This is used to set a default value for a variable. If the variable
- is empty or unset, the given default value is printed instead.
- Default takes one argument.
-
-
-default
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle|default:"no title"}
-{$myTitle|default:"no title"}
-
-OUTPUT:
-
-Dealers Will Hear Car Talk at Noon.
-no title
-
-
-
- escape
-
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Possible Values
- Default
- Description
-
-
-
-
- 1
- string
- No
- html,htmlall,url,quotes,hex,hexentity,javascript
- html
- This is the escape format to use.
-
-
-
-
-
- This is used to html escape, url escape, escape single quotes on a
- variable not already escaped, hex escape, hexentity or javascript escape.
- By default, the variable is html
- escaped.
-
-
-escape
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|escape}
-{$articleTitle|escape:"html"} {* escapes & " ' < > *}
-{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
-{$articleTitle|escape:"url"}
-{$articleTitle|escape:"quotes"}
-<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
-
-OUTPUT:
-
-'Stiff Opposition Expected to Casketless Funeral Plan'
-'Stiff Opposition Expected to Casketless Funeral Plan'
-'Stiff Opposition Expected to Casketless Funeral Plan'
-'Stiff Opposition Expected to Casketless Funeral Plan'
-%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
-\'Stiff Opposition Expected to Casketless Funeral Plan\'
-<a href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a>
-
-
-
- indent
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- integer
- No
- 4
- This determines how many characters to indent
- to.
-
-
- 2
- string
- No
- (one space)
- This is the character used to indent with.
-
-
-
-
-
- This indents a string at each line, default is 4. As
- an optional parameter, you can specify the number of characters to
- indent. As an optional second parameter, you can specify the
- character to use to indent with. (Use "\t" for tabs.)
-
-
-indent
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.');
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-
-{$articleTitle|indent}
-
-{$articleTitle|indent:10}
-
-{$articleTitle|indent:1:"\t"}
-
-OUTPUT:
-
-NJ judge to rule on nude beach.
-Sun or rain expected today, dark tonight.
-Statistics show that teen pregnancy drops off significantly after 25.
-
- NJ judge to rule on nude beach.
- Sun or rain expected today, dark tonight.
- Statistics show that teen pregnancy drops off significantly after 25.
-
- NJ judge to rule on nude beach.
- Sun or rain expected today, dark tonight.
- Statistics show that teen pregnancy drops off significantly after 25.
-
- NJ judge to rule on nude beach.
- Sun or rain expected today, dark tonight.
- Statistics show that teen pregnancy drops off significantly after 25.
-
-
-
- lower
-
- This is used to lowercase a variable.
-
-
-lower
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|lower}
-
-OUTPUT:
-
-Two Convicts Evade Noose, Jury Hung.
-two convicts evade noose, jury hung.
-
-
-
- nl2br
-
- All linebreaks will be converted to <br /> tags in the given
- variable. This is equivalent to the PHP nl2br() function.
-
-
-nl2br
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle|nl2br}
-
-OUTPUT:
-
-Sun or rain expected<br />today, dark tonight
-
-
-
- regex_replace
-
-
+7
+]]>
+
+
+
+
+ date_format
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ No
+ %b %e, %Y
+ This is the format for the outputted date.
+
+
+ 2
+ string
+ No
+ n/a
+ This is the default date if the input is empty.
+
+
+
+
+
+ This formats a date and time into the given strftime() format.
+ Dates can be passed to Smarty as unix timestamps, mysql timestamps
+ or any string made up of month day year (parsable by strtotime).
+ Designers can then use date_format to have complete control of the
+ formatting of the date. If the date passed to date_format is empty
+ and a second parameter is passed, that will be used as the date to
+ format.
+
+
+ date_format
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('yesterday', strtotime('-1 day'));
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+
+ {$smarty.now|date_format}
+ {$smarty.now|date_format:"%A, %B %e, %Y"}
+ {$smarty.now|date_format:"%H:%M:%S"}
+ {$yesterday|date_format}
+ {$yesterday|date_format:"%A, %B %e, %Y"}
+ {$yesterday|date_format:"%H:%M:%S"}
+
+ OUTPUT:
+
+ Feb 6, 2001
+ Tuesday, February 6, 2001
+ 14:33:00
+ Feb 5, 2001
+ Monday, February 5, 2001
+ 14:33:00
+
+
+ date_format conversion specifiers:
+
+
+ %a - abbreviated weekday name according to the current locale
+
+
+ %A - full weekday name according to the current locale
+
+
+ %b - abbreviated month name according to the current locale
+
+
+ %B - full month name according to the current locale
+
+
+ %c - preferred date and time representation for the current locale
+
+
+ %C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+
+
+ %d - day of the month as a decimal number (range 00 to 31)
+
+
+ %D - same as %m/%d/%y
+
+
+ %e - day of the month as a decimal number, a single digit is preceded by a space (range 1 to 31)
+
+
+ %g - Week-based year within century [00,99]
+
+
+ %G - Week-based year, including the century [0000,9999]
+
+
+ %h - same as %b
+
+
+ %H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+
+
+ %I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+
+
+ %j - day of the year as a decimal number (range 001 to 366)
+
+
+ %k - Hour (24-hour clock) single digits are preceded by a blank. (range 0 to 23)
+
+
+ %l - hour as a decimal number using a 12-hour clock, single digits preceeded by a space (range 1 to 12)
+
+
+ %m - month as a decimal number (range 01 to 12)
+
+
+ %M - minute as a decimal number
+
+
+ %n - newline character
+
+
+ %p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale
+
+
+ %r - time in a.m. and p.m. notation
+
+
+ %R - time in 24 hour notation
+
+
+ %S - second as a decimal number
+
+
+ %t - tab character
+
+
+ %T - current time, equal to %H:%M:%S
+
+
+ %u - weekday as a decimal number [1,7], with 1 representing Monday
+
+
+ %U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
+
+
+ %V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
+
+
+ %w - day of the week as a decimal, Sunday being 0
+
+
+ %W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
+
+
+ %x - preferred date representation for the current locale without the time
+
+
+ %X - preferred time representation for the current locale without the date
+
+
+ %y - year as a decimal number without a century (range 00 to 99)
+
+
+ %Y - year as a decimal number including the century
+
+
+ %Z - time zone or name or abbreviation
+
+
+ %% - a literal `%' character
+
+
+
+ Programmers note
+
+ date_format is essentially a wrapper to PHP's strftime()
+ function. You may have more or less conversion specifiers available depending
+ on your system's strftime() function where PHP was compiled. Check your
+ system's manpage for a full list of valid specifiers.
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ No
+ empty
+ This is the default value to output if the
+ variable is empty.
+
+
+
+
+
+ This is used to set a default value for a variable. If the variable
+ is empty or unset, the given default value is printed instead.
+ Default takes one argument.
+
+
+ default
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle|default:"no title"}
+ {$myTitle|default:"no title"}
+
+ OUTPUT:
+
+ Dealers Will Hear Car Talk at Noon.
+ no title
+
+
+
+ escape
+
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Possible Values
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ No
+ html,htmlall,url,quotes,hex,hexentity,javascript
+ html
+ This is the escape format to use.
+
+
+
+
+
+ This is used to html escape, url escape, escape single quotes on a
+ variable not already escaped, hex escape, hexentity or javascript escape.
+ By default, the variable is html
+ escaped.
+
+
+ escape
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|escape}
+ {$articleTitle|escape:"html"} {* escapes & " ' < > *}
+ {$articleTitle|escape:"htmlall"} {* escapes ALL html entities *}
+ {$articleTitle|escape:"url"}
+ {$articleTitle|escape:"quotes"}
+ <a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
+
+ OUTPUT:
+
+ 'Stiff Opposition Expected to Casketless Funeral Plan'
+ 'Stiff Opposition Expected to Casketless Funeral Plan'
+ 'Stiff Opposition Expected to Casketless Funeral Plan'
+ 'Stiff Opposition Expected to Casketless Funeral Plan'
+ %27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
+ \'Stiff Opposition Expected to Casketless Funeral Plan\'
+ <a href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">bob@me.net</a>
+
+
+
+ indent
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ integer
+ No
+ 4
+ This determines how many characters to indent
+ to.
+
+
+ 2
+ string
+ No
+ (one space)
+ This is the character used to indent with.
+
+
+
+
+
+ This indents a string at each line, default is 4. As
+ an optional parameter, you can specify the number of characters to
+ indent. As an optional second parameter, you can specify the
+ character to use to indent with. (Use "\t" for tabs.)
+
+
+ indent
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', 'NJ judge to rule on nude beach.');
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+
+ {$articleTitle|indent}
+
+ {$articleTitle|indent:10}
+
+ {$articleTitle|indent:1:"\t"}
+
+ OUTPUT:
+
+ NJ judge to rule on nude beach.
+ Sun or rain expected today, dark tonight.
+ Statistics show that teen pregnancy drops off significantly after 25.
+
+ NJ judge to rule on nude beach.
+ Sun or rain expected today, dark tonight.
+ Statistics show that teen pregnancy drops off significantly after 25.
+
+ NJ judge to rule on nude beach.
+ Sun or rain expected today, dark tonight.
+ Statistics show that teen pregnancy drops off significantly after 25.
+
+ NJ judge to rule on nude beach.
+ Sun or rain expected today, dark tonight.
+ Statistics show that teen pregnancy drops off significantly after 25.
+
+
+
+ lower
+
+ This is used to lowercase a variable.
+
+
+ lower
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|lower}
+
+ OUTPUT:
+
+ Two Convicts Evade Noose, Jury Hung.
+ two convicts evade noose, jury hung.
+
+
+
+ nl2br
+
+ All linebreaks will be converted to <br /> tags in the given
+ variable. This is equivalent to the PHP nl2br() function.
+
+
+ nl2br
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle|nl2br}
+
+ OUTPUT:
+
+ Sun or rain expected<br />today, dark tonight
+
+
+
+ regex_replace
+
+
-
- Parameter Position
- Type
- Required
- Default
- Description
-
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
-
- 1
- string
- Yes
- n/a
- This is the regular expression to be replaced.
-
-
- 2
- string
- Yes
- n/a
- This is the string of text to replace with.
-
+
+ 1
+ string
+ Yes
+ n/a
+ This is the regular expression to be replaced.
+
+
+ 2
+ string
+ Yes
+ n/a
+ This is the string of text to replace with.
+
-
-
-
- A regular expression search and replace on a variable. Use the
- syntax for preg_replace() from the PHP manual.
-
-
-regex_replace
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{* replace each carriage return, tab & new line with a space *}
-
-{$articleTitle}
-{$articleTitle|regex_replace:"/[\r\t\n]/":" "}
-
-OUTPUT:
-
-Infertility unlikely to
- be passed on, experts say.
-Infertility unlikely to be passed on, experts say.
-
-
-
- replace
-
+
+
+
+ A regular expression search and replace on a variable. Use the
+ syntax for preg_replace() from the PHP manual.
+
+
+ regex_replace
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {* replace each carriage return, tab & new line with a space *}
+
+ {$articleTitle}
+ {$articleTitle|regex_replace:"/[\r\t\n]/":" "}
+
+ OUTPUT:
+
+ Infertility unlikely to
+ be passed on, experts say.
+ Infertility unlikely to be passed on, experts say.
+
+
+
+ replace
+
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- string
- Yes
- n/a
- This is the string of text to be replaced.
-
-
- 2
- string
- Yes
- n/a
- This is the string of text to replace with.
-
-
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ Yes
+ n/a
+ This is the string of text to be replaced.
+
+
+ 2
+ string
+ Yes
+ n/a
+ This is the string of text to replace with.
+
+
-
-
- A simple search and replace on a variable.
-
-
-replace
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|replace:"Garden":"Vineyard"}
-{$articleTitle|replace:" ":" "}
-
-OUTPUT:
-
-Child's Stool Great for Use in Garden.
-Child's Stool Great for Use in Vineyard.
-Child's Stool Great for Use in Garden.
-
-
-
- spacify
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
+
+
+ A simple search and replace on a variable.
+
+
+ replace
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|replace:"Garden":"Vineyard"}
+ {$articleTitle|replace:" ":" "}
+
+ OUTPUT:
+
+ Child's Stool Great for Use in Garden.
+ Child's Stool Great for Use in Vineyard.
+ Child's Stool Great for Use in Garden.
+
+
+
+ spacify
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ No
+ one space
+ This what gets inserted between each character of
+ the variable.
-
-
-
- 1
- string
- No
- one space
- This what gets inserted between each character of
- the variable.
-
-
-
-
-
- spacify is a way to insert a space between every character of a variable.
- You can optionally pass a different character (or string) to insert.
-
-
-spacify
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|spacify}
-{$articleTitle|spacify:"^^"}
-
-OUTPUT:
-
-Something Went Wrong in Jet Crash, Experts Say.
-S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
-S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.
-
-
-
- string_format
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- string
- Yes
- n/a
- This is what format to use. (sprintf)
-
-
-
-
-
- This is a way to format strings, such as decimal numbers and such.
- Use the syntax for sprintf for the formatting.
-
-
-string_format
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('number', 23.5787446);
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$number}
-{$number|string_format:"%.2f"}
-{$number|string_format:"%d"}
-
-OUTPUT:
-
-23.5787446
-23.58
-24
-
-
-
- strip
-
- This replaces all repeated spaces, newlines and tabs with a single
- space, or with a supplied string.
-
-
- Note
-
- If you want to strip blocks of template text, use the strip function.
-
-
-
-strip
-
+
+
+
+
+ spacify is a way to insert a space between every character of a variable.
+ You can optionally pass a different character (or string) to insert.
+
+
+ spacify
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|spacify}
+ {$articleTitle|spacify:"^^"}
+
+ OUTPUT:
+
+ Something Went Wrong in Jet Crash, Experts Say.
+ S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
+ S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.
+
+
+
+ string_format
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ string
+ Yes
+ n/a
+ This is what format to use. (sprintf)
+
+
+
+
+
+ This is a way to format strings, such as decimal numbers and such.
+ Use the syntax for sprintf for the formatting.
+
+
+ string_format
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('number', 23.5787446);
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$number}
+ {$number|string_format:"%.2f"}
+ {$number|string_format:"%d"}
+
+ OUTPUT:
+
+ 23.5787446
+ 23.58
+ 24
+
+
+
+ strip
+
+ This replaces all repeated spaces, newlines and tabs with a single
+ space, or with a supplied string.
+
+
+ Note
+
+ If you want to strip blocks of template text, use the strip function.
+
+
+
+ strip
+
-
-
-
- strip_tags
-
- This strips out markup tags, basically anything between < and >.
-
-
-strip_tags
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|strip_tags}
-
-OUTPUT:
-
-Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
-Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
-
-
-
- truncate
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- integer
- No
- 80
- This determines how many characters to truncate
- to.
-
-
- 2
- string
- No
- ...
- This is the text to append if truncation occurs.
-
-
- 3
- boolean
- No
- false
- This determines whether or not to truncate at a
- word boundary (false), or at the exact character (true).
-
-
-
-
-
- This truncates a variable to a character length, default is 80. As
- an optional second parameter, you can specify a string of text
- to display at the end if the variable was truncated. The
- characters in the string are included with the original truncation length.
- By default, truncate will attempt to cut off at a word boundary. If
- you want to cut off at the exact character length, pass the optional
- third parameter of true.
-
-
-truncate
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|truncate}
-{$articleTitle|truncate:30}
-{$articleTitle|truncate:30:""}
-{$articleTitle|truncate:30:"---"}
-{$articleTitle|truncate:30:"":true}
-{$articleTitle|truncate:30:"...":true}
-
-OUTPUT:
-
-Two Sisters Reunite after Eighteen Years at Checkout Counter.
-Two Sisters Reunite after Eighteen Years at Checkout Counter.
-Two Sisters Reunite after...
-Two Sisters Reunite after
-Two Sisters Reunite after---
-Two Sisters Reunite after Eigh
-Two Sisters Reunite after E...
-
-
-
- upper
-
- This is used to uppercase a variable.
-
-
-upper
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-{$articleTitle|upper}
-
-OUTPUT:
-
-If Strike isn't Settled Quickly it may Last a While.
-IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.
-
-
-
- wordwrap
-
-
-
-
-
-
-
-
-
- Parameter Position
- Type
- Required
- Default
- Description
-
-
-
-
- 1
- integer
- No
- 80
- This determines how many columns to wrap
- to.
-
-
- 2
- string
- No
- \n
- This is the string used to wrap words with.
-
-
- 3
- boolean
- No
- false
- This determines whether or not to wrap at a
- word boundary (false), or at the exact character (true).
-
-
-
-
-
- This wraps a string to a column width, default is 80. As
- an optional second parameter, you can specify a string of text
- to wrap the text to the next line (default is carriage return \n).
- By default, wordwrap will attempt to wrap at a word boundary. If
- you want to cut off at the exact character length, pass the optional
- third parameter of true.
-
-
-wordwrap
-
-index.php:
-
-$smarty = new Smarty;
-$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
-$smarty->display('index.tpl');
-
-index.tpl:
-
-{$articleTitle}
-
-{$articleTitle|wordwrap:30}
-
-{$articleTitle|wordwrap:20}
-
-{$articleTitle|wordwrap:30:"<br>\n"}
-
-{$articleTitle|wordwrap:30:"\n":true}
-
-OUTPUT:
-
-Blind woman gets new kidney from dad she hasn't seen in years.
-
-Blind woman gets new kidney
-from dad she hasn't seen in
-years.
-
-Blind woman gets new
-kidney from dad she
-hasn't seen in
-years.
-
-Blind woman gets new kidney<br>
-from dad she hasn't seen in years.
-
-Blind woman gets new kidney fr
-om dad she hasn't seen in year
-s.
-
-
-
-
+
+
+
+ strip_tags
+
+ This strips out markup tags, basically anything between < and >.
+
+
+ strip_tags
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|strip_tags}
+
+ OUTPUT:
+
+ Blind Woman Gets <font face="helvetica">New Kidney</font> from Dad she Hasn't Seen in <b>years</b>.
+ Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
+
+
+
+ truncate
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ integer
+ No
+ 80
+ This determines how many characters to truncate
+ to.
+
+
+ 2
+ string
+ No
+ ...
+ This is the text to append if truncation occurs.
+
+
+ 3
+ boolean
+ No
+ false
+ This determines whether or not to truncate at a
+ word boundary (false), or at the exact character (true).
+
+
+
+
+
+ This truncates a variable to a character length, default is 80. As
+ an optional second parameter, you can specify a string of text
+ to display at the end if the variable was truncated. The
+ characters in the string are included with the original truncation length.
+ By default, truncate will attempt to cut off at a word boundary. If
+ you want to cut off at the exact character length, pass the optional
+ third parameter of true.
+
+
+ truncate
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|truncate}
+ {$articleTitle|truncate:30}
+ {$articleTitle|truncate:30:""}
+ {$articleTitle|truncate:30:"---"}
+ {$articleTitle|truncate:30:"":true}
+ {$articleTitle|truncate:30:"...":true}
+
+ OUTPUT:
+
+ Two Sisters Reunite after Eighteen Years at Checkout Counter.
+ Two Sisters Reunite after Eighteen Years at Checkout Counter.
+ Two Sisters Reunite after...
+ Two Sisters Reunite after
+ Two Sisters Reunite after---
+ Two Sisters Reunite after Eigh
+ Two Sisters Reunite after E...
+
+
+
+ upper
+
+ This is used to uppercase a variable.
+
+
+ upper
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+ {$articleTitle|upper}
+
+ OUTPUT:
+
+ If Strike isn't Settled Quickly it may Last a While.
+ IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.
+
+
+
+ wordwrap
+
+
+
+
+
+
+
+
+
+ Parameter Position
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ 1
+ integer
+ No
+ 80
+ This determines how many columns to wrap
+ to.
+
+
+ 2
+ string
+ No
+ \n
+ This is the string used to wrap words with.
+
+
+ 3
+ boolean
+ No
+ false
+ This determines whether or not to wrap at a
+ word boundary (false), or at the exact character (true).
+
+
+
+
+
+ This wraps a string to a column width, default is 80. As
+ an optional second parameter, you can specify a string of text
+ to wrap the text to the next line (default is carriage return \n).
+ By default, wordwrap will attempt to wrap at a word boundary. If
+ you want to cut off at the exact character length, pass the optional
+ third parameter of true.
+
+
+ wordwrap
+
+ index.php:
+
+ $smarty = new Smarty;
+ $smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
+ $smarty->display('index.tpl');
+
+ index.tpl:
+
+ {$articleTitle}
+
+ {$articleTitle|wordwrap:30}
+
+ {$articleTitle|wordwrap:20}
+
+ {$articleTitle|wordwrap:30:"<br>\n"}
+
+ {$articleTitle|wordwrap:30:"\n":true}
+
+ OUTPUT:
+
+ Blind woman gets new kidney from dad she hasn't seen in years.
+
+ Blind woman gets new kidney
+ from dad she hasn't seen in
+ years.
+
+ Blind woman gets new
+ kidney from dad she
+ hasn't seen in
+ years.
+
+ Blind woman gets new kidney<br>
+ from dad she hasn't seen in years.
+
+ Blind woman gets new kidney fr
+ om dad she hasn't seen in year
+ s.
+
+
+
+