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
# strip
148 lars 2
 
3
This replaces all spaces, newlines and tabs with a single space, or with
4
the supplied string.
5
 
991 lars 6
## Basic usage
7
```smarty
8
{$myVar|strip}
9
```
10
 
148 lars 11
> **Note**
12
>
13
> If you want to strip blocks of template text, use the built-in
991 lars 14
> [`{strip}`](../language-builtin-functions/language-function-strip.md) function.
148 lars 15
 
991 lars 16
## Examples
148 lars 17
 
991 lars 18
```php
19
<?php
20
$smarty->assign('articleTitle', "Grandmother of\neight makes\t    hole in one.");
21
$smarty->display('index.tpl');
22
```
148 lars 23
 
24
Where template is:
25
 
991 lars 26
```smarty
27
{$articleTitle}
28
{$articleTitle|strip}
29
{$articleTitle|strip:'&nbsp;'}
30
```
148 lars 31
 
32
Will output:
33
 
991 lars 34
```html
35
Grandmother of
36
eight makes        hole in one.
37
Grandmother of eight makes hole in one.
38
Grandmother&nbsp;of&nbsp;eight&nbsp;makes&nbsp;hole&nbsp;in&nbsp;one.
39
```
148 lars 40
 
991 lars 41
See also [`{strip}`](../language-builtin-functions/language-function-strip.md) and
42
[`truncate`](language-modifier-truncate.md).