| 148 |
lars |
1 |
capitalize {#language.modifier.capitalize}
|
|
|
2 |
==========
|
|
|
3 |
|
|
|
4 |
This is used to capitalize the first letter of all words in a variable.
|
|
|
5 |
This is similar to the PHP [`ucwords()`](&url.php-manual;ucwords)
|
|
|
6 |
function.
|
|
|
7 |
|
|
|
8 |
Parameter Position Type Required Default Description
|
|
|
9 |
-------------------- --------- ---------- --------- -----------------------------------------------------------------------------------------------------------
|
|
|
10 |
1 boolean No FALSE This determines whether or not words with digits will be uppercased
|
|
|
11 |
2 boolean No FALSE This determines whether or not Capital letters within words should be lowercased, e.g. \"aAa\" to \"Aaa\"
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
<?php
|
|
|
15 |
|
|
|
16 |
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
|
|
|
17 |
|
|
|
18 |
?>
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
Where the template is:
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
{$articleTitle}
|
|
|
26 |
{$articleTitle|capitalize}
|
|
|
27 |
{$articleTitle|capitalize:true}
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
Will output:
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
next x-men film, x3, delayed.
|
|
|
35 |
Next X-Men Film, x3, Delayed.
|
|
|
36 |
Next X-Men Film, X3, Delayed.
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
See also [`lower`](#language.modifier.lower) and
|
|
|
41 |
[`upper`](#language.modifier.upper)
|