| 148 |
lars |
1 |
Combining Modifiers {#language.combining.modifiers}
|
|
|
2 |
===================
|
|
|
3 |
|
|
|
4 |
You can apply any number of modifiers to a variable. They will be
|
|
|
5 |
applied in the order they are combined, from left to right. They must be
|
|
|
6 |
separated with a `|` (pipe) character.
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
<?php
|
|
|
10 |
|
|
|
11 |
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
|
|
|
12 |
|
|
|
13 |
?>
|
|
|
14 |
|
|
|
15 |
where template is:
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
{$articleTitle}
|
|
|
19 |
{$articleTitle|upper|spacify}
|
|
|
20 |
{$articleTitle|lower|spacify|truncate}
|
|
|
21 |
{$articleTitle|lower|truncate:30|spacify}
|
|
|
22 |
{$articleTitle|lower|spacify|truncate:30:". . ."}
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
The above example will output:
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
Smokers are Productive, but Death Cuts Efficiency.
|
|
|
30 |
S M O K E R S A R ....snip.... H C U T S E F F I C I E N C Y .
|
|
|
31 |
s m o k e r s a r ....snip.... b u t d e a t h c u t s...
|
|
|
32 |
s m o k e r s a r e p r o d u c t i v e , b u t . . .
|
|
|
33 |
s m o k e r s a r e p. . .
|
|
|
34 |
|
|
|
35 |
|