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
# nl2br
148 lars 2
 
3
All `"\n"` line breaks will be converted to html `<br />` tags in the
4
given variable. This is equivalent to the PHP\'s
991 lars 5
[`nl2br()`](https://www.php.net/nl2br) function.
148 lars 6
 
991 lars 7
## Basic usage
8
```smarty
9
{$myVar|nl2br}
10
```
148 lars 11
 
991 lars 12
## Examples
148 lars 13
 
991 lars 14
```php
15
<?php
148 lars 16
 
991 lars 17
$smarty->assign('articleTitle',
18
                "Sun or rain expected\ntoday, dark tonight"
19
                );
148 lars 20
 
991 lars 21
```
148 lars 22
 
23
Where the template is:
24
 
991 lars 25
```smarty
26
{$articleTitle|nl2br}
27
```
148 lars 28
 
29
Will output:
30
 
991 lars 31
```
32
Sun or rain expected<br />today, dark tonight
33
```
148 lars 34
 
991 lars 35
See also [`word_wrap`](language-modifier-wordwrap.md),
36
[`count_paragraphs`](language-modifier-count-paragraphs.md) and
37
[`count_sentences`](language-modifier-count-sentences.md).