<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><th colspan="3" align="center">Smarty - the compiling PHP template engine</th></tr><tr><td width="25%" align="left" valign="bottom"><a href="language.math.html">Prev</a></td> <td width="50%" align="center" valign="bottom">Chapter 3. Basic Syntax[第3章.基本語法]</td> <td width="25%" align="right" valign="bottom"><a href="language.variables.html" accesskey="N">Next</a></td></tr></table> # Escaping Smarty Parsing[忽略Smarty解析] It is sometimes desirable or even necessary to have Smarty ignore sections it would otherwise parse. A classic example is embedding Javascript or CSS code in a template. The problem arises as those languages use the { and } characters which are also the default delimiters for Smarty. 有時,忽略Smarty對某些語句段的解析很有必要。一種典型的情況是嵌入到模板中的javascript或Css代碼。原因在于這些語言使用與Smarty默認定界符‘{’和‘}’一樣的符號。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>Note<br/> A good practice for avoiding escapement altogether is by separating your Javascript/CSS into their own files and use standard HTML methods to access them. This will also take advantage of browser script caching. When you need to embed Smarty variables/functions into your Javascript/<br/> CSS, then the following applies.<br/> 一個避免出現這種情況的好習慣是把你的javascript/css代碼分離出來保存成一個獨立文件,再用html方法鏈接到模版中。這樣做也有利于瀏覽器緩存腳本。如果你想把Smarty變量、方法嵌入到javascript/css,請看下面的運用。</td> </tr></table> In Smarty templates, the { and } braces will be ignored so long as they are surrounded by white space. This behavior can be disabled by setting the Smarty class variable $auto_literal to false. 在Smarty模版,如果‘{’和‘}’大括號里包含有空格那么整個{}內容會被忽略,你可以設置Smarty類變量$auto_literal=false來取消這種規則。 **Example 3.8. Using the auto-literal feature** **Example 3.8. 使用auto-literal(自動原義)特性** <table border="0" bgcolor="#E0E0E0" width="100%"><tr><td> <p>&lt;script&gt;<br/> // the following braces are ignored by Smarty 以下大括號的內容會被Smarty忽略<br/> // since they are surrounded by whitespace 因為它們里面有空格<br/> function foobar {<br/> alert('foobar!');<br/> }<br/> // this one will need literal escapement 下面的內容會保持原義輸出<br/> {literal}<br/> function bazzy {alert('foobar!');}<br/> {/literal}<br/> &lt;/script&gt;</p> </td></tr></table> {literal}..{/literal} blocks are used for escaping blocks of template logic. You can also escape the braces individually with {ldelim},{rdelim} tags or {$smarty.ldelim},{$smarty.rdelim} variables. Smarty's default delimiters { and } cleanly represent presentational content. However if another set of delimiters suit your needs better, you can change them with Smarty's $left_delimiter and $right_delimiter values. [{literal}](#)...{/literal}塊被用來忽略模版語法的解析,你也可以用[{ldelim}](#)、[{rdelim}](#)標簽或[{$smarty.ldelim}](#)、[{$smarty.rdelim}](#)變量來忽略個別大括號(譯注:后面兩種方法主要用來在模版中輸出左右大括號)。 Smarty默認定界符‘{’和‘}’簡潔地描述具體的內容,然而如果你有更好的定界符設置,也可以用Smarty的[$left_delimiter](#)和[$right_delimiter](#)設置相應的值。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td><p>Note:Changing delimiters affects ALL template syntax and escapement. Be sure to clear out cache and<br/> compiled files if you decide to change them.<br/> 在決定更改影響所有模版語法和忽略解析系統的定界符之前,請確定清除所有緩存和編譯文件。</p> </td> </tr></table> **Example 3.9. changing delimiters example** **Example 3.9. 更改定界符例子** <table border="0" bgcolor="#E0E0E0" width="100%"><tr><td> <p>&lt;?php<br/> $smarty-&gt;left_delimiter = '&lt;!--{';<br/> $smarty-&gt;right_delimiter = '}--&gt;';<br/> $smarty-&gt;assign('foo', 'bar');<br/> $smarty-&gt;assign('name', 'Albert');<br/> $smarty-&gt;display('example.tpl');<br/> ?&gt;</p> <p>模版:<br/> Welcome &lt;!--{$name}--&gt; to Smarty<br/> &lt;script language="javascript"&gt;<br/> var foo = &lt;!--{$foo}--&gt;;<br/> function dosomething() {<br/> alert("foo is " + foo);<br/> }<br/> dosomething();<br/> &lt;/script&gt;</p></td></tr></table> <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="language.math.html" accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="language.variables.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Math<br/> 數學運算</td><td width="34%" align="center" valign="top"><a href="language.basic.syntax.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Variables<br/> 變量 </td></tr></table>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看