Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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