Default Variable Handling

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 18. Tips & Tricks[使用技巧和经验] Next

Default Variable Handling

默认变量处理

{* do this somewhere at the top of your template *}
{assign var="title" value=$title|default:"no title"}

{* if $title was empty, it now contains the value "no title" when you print it *}
{$title}

Prev 来源:PHP中文社区 Home Next
Up