<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Chapter 6. Combining Modifiers</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Smarty Manual"> <link rel="up" href="smarty.for.designers.html" title="Part II. Smarty For Template Designers"> <link rel="prev" href="language.modifier.wordwrap.html" title="wordwrap"> <link rel="next" href="language.builtin.functions.html" title="Chapter 7. Built-in Functions"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">Chapter 6. Combining Modifiers</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="language.modifier.wordwrap.html">Prev</a> </td> <th width="60%" align="center">Part II. Smarty For Template Designers</th> <td width="20%" align="right"> <a accesskey="n" href="language.builtin.functions.html">Next</a> </td> </tr> </table> <hr> </div> <div class="chapter" title="Chapter 6. Combining Modifiers"> <div class="titlepage"><div><div><h2 class="title"> <a name="language.combining.modifiers"></a>Chapter 6. Combining Modifiers</h2></div></div></div> <p> You can apply any number of modifiers to a variable. They will be applied in the order they are combined, from left to right. They must be separated with a <code class="literal">|</code> (pipe) character. </p> <div class="example"> <a name="id3044794"></a><p class="title"><b>Example 6.1. combining modifiers</b></p> <div class="example-contents"> <pre class="programlisting"> <?php $smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.'); ?> </pre> <p> where template is: </p> <pre class="programlisting"> {$articleTitle} {$articleTitle|upper|spacify} {$articleTitle|lower|spacify|truncate} {$articleTitle|lower|truncate:30|spacify} {$articleTitle|lower|spacify|truncate:30:". . ."} </pre> <p> The above example will output: </p> <pre class="screen"> Smokers are Productive, but Death Cuts Efficiency. 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 . s m o k e r s a r ....snip.... b u t d e a t h c u t s... s m o k e r s a r e p r o d u c t i v e , b u t . . . s m o k e r s a r e p. . . </pre> </div> </div> <br class="example-break"> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="language.modifier.wordwrap.html">Prev</a> </td> <td width="20%" align="center"><a accesskey="u" href="smarty.for.designers.html">Up</a></td> <td width="40%" align="right"> <a accesskey="n" href="language.builtin.functions.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top">wordwrap </td> <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td> <td width="40%" align="right" valign="top"> Chapter 7. Built-in Functions</td> </tr> </table> </div> </body> </html>