What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
Nombre del Atributo | Tipo | Requerido | Default | Descripción |
---|---|---|---|---|
style | string | No | n/a | estilo pre-definido |
indent | number | No | 0 | Número de caracteres para endentar cada linea. |
indent_first | number | No | 0 | Número de caracteres para endentar la primera linea |
indent_char | string | No | (single space) | El carácter (o cadena de caracteres) para endentar |
wrap | number | No | 80 | Cuantos caracteres tendra cada linea |
wrap_char | string | No | \n | Caracter (o cadena de caracteres) a usar para saltar cada linea |
wrap_cut | boolean | No | false | Si es true, wrap saltara la linea en el carácter exacto en vez de saltar al final de la palabra. |
assign | string | No | n/a | La variable del template que recibirá la salida |
{textformat} es una función de bloque usada para formatear texto. Básicamente limpa espacios y caracteres especiales, y formatea los párrafos cortando el texto al final de la palabra y endentando lineas.
Usted puede definir los parámetros explícitamente, o usar un estilo pre-definido. Actualmente el único estilo disponible es "email".
Example 8.23. {textformat}
{textformat wrap=40} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
Salida del ajemplo de arriba:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat wrap=40 indent=4} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
Salida del ejemplo de arriba:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat wrap=40 indent=4 indent_first=4} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
Salida del ejemplo de arriba:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
{textformat style="email"} This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. {/textformat}
Salida del ejemplo de arriba:
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo. This is bar. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo.
Ver también {strip} y {wordwrap}.