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

{php}

{php} タグで、PHP コードを直接テンプレートに埋め込むことができます。 $php_handling の設定にかかわらず、これはエスケープされません。 このタグは上級ユーザのためのものなので通常は必要とされません。

テクニカルノート

{php} ブロック内の PHP 変数にアクセスするには、PHP の global キーワードを使う必要があります。

Example 7.28. {php} タグ内での PHP コード


{php}
   // PHP スクリプトをテンプレートから直接インクルードします
   include('/path/to/display_weather.php');
{/php}

  

Example 7.29. {php} タグで global を使用して変数を代入する


{* このテンプレートは {php} ブロックを含み、その中で変数 $varX を割り当てます *}
{php}
   global $foo, $bar;
   if($foo == $bar){
     echo 'This will be sent to browser';
   }
  // 変数を Smarty に割り当てます
  $this->assign('varX','Toffee');
{/php}
{* 変数を出力します *}
<strong>{$varX}</strong> is my fav ice cream :-)

  

$php_handling{include_php}{include}{insert} および コンポーネント化したテンプレート も参照してください。

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 19 plus 11? (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