Linux Tutorials | cPanel Tutorials | Remote System Administration
strip

strip

Este substituye todos los espacios repetidos, nuevas lineas y tabs por un unico espacio u otra cadena indicada.

Nota: Si usted quiere substituir bloques de texto de un template use la función strip.

Ejemplo 5-18. strip

<?php

$smarty
= new Smarty;
$smarty->assign('articleTitle', "Grandmother of\neight makes\t    hole in one.");
$smarty->display('index.tpl');

?>

Donde index.tpl es:

{$articleTitle}
{$articleTitle|strip}
{$articleTitle|strip:"&nbsp;"}

Esta es la Salida:

Grandmother of
eight makes        hole in one.
Grandmother of eight makes hole in one.
Grandmother&nbsp;of&nbsp;eight&nbsp;makes&nbsp;hole&nbsp;in&nbsp;one.