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

関数

すべての Smarty タグは、 変数 を出力するか何らかの関数を呼び出す動作をします。 関数は、 {funcname attr1='val1' attr2='val2'} のように関数名とその 属性 をデリミタで囲みます。

Example 3.3. 関数の構文


{config_load file='colors.conf'}

{include file='header.tpl'}
{insert file='banner_ads.tpl' title='イケてる Smarty'}

{if $logged_in}
    ようこそ、<font color="{#fontColor#}">{$name}!</font>
{else}
    やぁ、{$name}
{/if}

{include file='footer.tpl' ad=$random_id}

  

  • 組み込み関数カスタム関数 は、テンプレート内では同じ構文です。

  • 組み込み関数とは Smarty の 内部で 動作する関数で、たとえば {if}{section} および {strip} などのことです。これらを変更したり修正したりすることはありません。

  • カスタム関数は 追加の 関数で、 プラグイン で実装します。 これらは自由に修正したり、新たな関数を追加したりする事が可能です。 {html_options}{popup} などがカスタム関数の例です。

register_function() も参照してください。

Comments
No comments for this page.

Advertisement

Sponsors [info]

Sponsors