| 148 |
lars |
1 |
spacify {#language.modifier.spacify}
|
|
|
2 |
=======
|
|
|
3 |
|
|
|
4 |
`spacify` is a way to insert a space between every character of a
|
|
|
5 |
variable. You can optionally pass a different character or string to
|
|
|
6 |
insert.
|
|
|
7 |
|
|
|
8 |
Parameter Position Type Required Default Description
|
|
|
9 |
-------------------- -------- ---------- ------------- -----------------------------------------------------------------
|
|
|
10 |
1 string No *one space* This what gets inserted between each character of the variable.
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
<?php
|
|
|
14 |
|
|
|
15 |
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
|
|
|
16 |
|
|
|
17 |
?>
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
Where template is:
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
{$articleTitle}
|
|
|
25 |
{$articleTitle|spacify}
|
|
|
26 |
{$articleTitle|spacify:"^^"}
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
Will output:
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
Something Went Wrong in Jet Crash, Experts Say.
|
|
|
34 |
S o m e t h i n g W .... snip .... s h , E x p e r t s S a y .
|
|
|
35 |
S^^o^^m^^e^^t^^h^^i^^n^^g^^ .... snip .... ^^e^^r^^t^^s^^ ^^S^^a^^y^^.
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
See also [`wordwrap`](#language.modifier.wordwrap) and
|
|
|
40 |
[`nl2br`](#language.modifier.nl2br).
|