Get Smarty

Donate

Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

default

変数のデフォルト値を設定します。変数が空であるか設定されていない場合に、 代わりとしてデフォルト値が表示されます。この修飾子は1つのパラメータをとります。

パラメータの位置 必須 デフォルト 概要
1 string No empty 変数が空の場合に表示されるデフォルト値

Example 5.9. default


<?php

$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->assign('email', '');

?>

   

テンプレート


{$articleTitle|default:'no title'}
{$myTitle|default:'no title'}
{$email|default:'No email address available'}

   

出力


Dealers Will Hear Car Talk at Noon.
no title
No email address available

   

変数のデフォルトの扱い および 空白の変数の扱い のページも参照してください。

Comments
No comments for this page.

Advertisement

Sponsors [info]

Sponsors