<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>spacify</title> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Smarty Manual"> <link rel="up" href="language.modifiers.html" title="Chapter 5. Variable Modifiers"> <link rel="prev" href="language.modifier.replace.html" title="replace"> <link rel="next" href="language.modifier.string.format.html" title="string_format"> </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">spacify</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="language.modifier.replace.html">Prev</a> </td> <th width="60%" align="center">Chapter 5. Variable Modifiers</th> <td width="20%" align="right"> <a accesskey="n" href="language.modifier.string.format.html">Next</a> </td> </tr> </table> <hr> </div> <div class="sect1" title="spacify"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="language.modifier.spacify"></a>spacify</h2></div></div></div> <p> <code class="varname">spacify</code> is a way to insert a space between every character of a variable. You can optionally pass a different character or string to insert. </p> <div class="informaltable"><table border="1"> <colgroup> <col align="center"> <col align="center"> <col align="center"> <col align="center"> <col> </colgroup> <thead><tr> <th align="center">Parameter Position</th> <th align="center">Type</th> <th align="center">Required</th> <th align="center">Default</th> <th>Description</th> </tr></thead> <tbody><tr> <td align="center">1</td> <td align="center">string</td> <td align="center">No</td> <td align="center"><span class="emphasis"><em>one space</em></span></td> <td>This what gets inserted between each character of the variable.</td> </tr></tbody> </table></div> <div class="example"> <a name="id3039111"></a><p class="title"><b>Example 5.17. spacify</b></p> <div class="example-contents"> <pre class="programlisting"> <?php $smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.'); ?> </pre> <p> Where template is: </p> <pre class="programlisting"> {$articleTitle} {$articleTitle|spacify} {$articleTitle|spacify:"^^"} </pre> <p> Will output: </p> <pre class="screen"> Something Went Wrong in Jet Crash, Experts Say. S o m e t h i n g W .... snip .... s h , E x p e r t s S a y . S^^o^^m^^e^^t^^h^^i^^n^^g^^ .... snip .... ^^e^^r^^t^^s^^ ^^S^^a^^y^^. </pre> </div> </div> <br class="example-break"><p> See also <a class="link" href="language.modifier.wordwrap.html" title="wordwrap"><code class="varname">wordwrap</code></a> and <a class="link" href="language.modifier.nl2br.html" title="nl2br"><code class="varname">nl2br</code></a>. </p> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="language.modifier.replace.html">Prev</a> </td> <td width="20%" align="center"><a accesskey="u" href="language.modifiers.html">Up</a></td> <td width="40%" align="right"> <a accesskey="n" href="language.modifier.string.format.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top">replace </td> <td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td> <td width="40%" align="right" valign="top"> string_format</td> </tr> </table> </div> </body> </html>