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:
Table of Contents
Cuando usted en algunas ocaciones quiere imprimir un valor que usted defíne a una variable vacia en vez de imprimir nada, tal como imprimir " " a fin de que el plano del fondo de la tabla funcione correctamente. Muchos usarian una sentencia {if} para manejar esto, mas existe otra forma con Smarty, usando el modificador de la variable default.
Example 18.1. Imprimiendo cuando una variable esta vacia
{* the long way *} {if $title eq ""} {else} {$title} {/if} {* the short way *} {$title|default:" "}
Ver tambien default y Default Variable Handling.