Table of Contents
å¾ˆå¤šæƒ…å†µä½ éƒ½éœ€è¦�显示一个默认值,æ�¥ä»£æ›¿ç©ºçš„å�˜é‡�。
如在HTMLçš„è¡¨æ ¼é‡Œé�¢æ˜¾ç¤º 。
通常å�¯ä»¥ç”¨{if}æ�¥è¿›è¡Œåˆ¤æ–,
而Smarty还�以通过更简便的default修饰器�处�。
Note
当PHP的error_reporting()级别或者Smarty的$error_reporting设置�E_NOTICE时,在模�内使用未赋值的��,将会�示
“未定义��� 错误。
Example 21.1. 当��为空时显示
{* the long way *}
{if $title eq ''}
{else}
{$title}
{/if}
{* the short way *}
{$title|default:' '}
��
default修饰器和
默认��处�.
