Get Smarty

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:

Check reviews of PHP Web Hosting, compatible with Smarty Templates

関数

すべての 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.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 6 plus 3? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
email marketing @ActiveCampaign
broadband deals @BroadbandGenie
Best UK Web Hosting @webhost.uk.net
Reliable UK and US Web Hosting @rshosting.com
Cheap US and UK Web Hosting @infrenion.com
I.T Certification Exams @pass-guaranteed.com
Certification Practice Tests @firsttrycertify.com
Certification Practice Exam Questions @ace-it-certifications.com
Broadband Speed Test @broadbandspeed.co.uk
bulk email software @americaint.com
ASP.NET hosting @aspnethosting.co.uk