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

{literal}

{literal} タグに囲まれたデータのブロックは、 リテラルとして認識されます。これは一般的に、Javascript やスタイルシートなどで 中括弧がテンプレートの デリミタ として解釈されるとまずい場合に使用します。 {literal}{/literal} タブの内部は解釈されず、 そのままで表示されます。{literal} ブロック内にテンプレートタグを含める必要がある場合は、代わりに {ldelim}{rdelim} で個々のデリミタをエスケープしてください。

Example 7.25. {literal} タグ


{literal}
<script type="text/javascript">
<!--
  function isblank(field) {
    if (field.value == '')
      { return false; }
    else
      {
      document.loginform.submit();
      return true;
    }
  }
// -->
</script>
{/literal}

  

Example 7.26. Javascript の関数の例


<script language="JavaScript" type="text/javascript">
{literal}
function myJsFunction(name, ip){
   alert("The server name\n" + name + "\n" + ip);
}
{/literal}
</script>
<a href="javascript:myJsFunction('{$smarty.server.SERVER_NAME}','{$smarty.server.SERVER_ADDR}')">Click here for the Server Info</a>
 
   

Example 7.27. テンプレート内での css style


{* included this style .. as an experiment *}
<style type="text/css">
{literal}
/* this is an intersting idea for this section */
.madIdea{
    border: 3px outset #ffffff;
    margin: 2 3 4 5px;
    background-color: #001122;
}
{/literal}
</style>
<div class="madIdea">With smarty you can embed CSS in the template</div>


{ldelim} {rdelim} および Smarty の構文解析を回避 のページも参照してください。

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 8 plus 0? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
Cheap Hosting @HostsVault
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