<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="tips.html" accesskey="P">Prev</a></td><td width="50%" align="center" valign="bottom">Chapter 18. Tips &amp; Tricks</td><td width="25%" align="right" valign="bottom"><a href="tips.default.var.handling.html" accesskey="N">Next</a></td></tr></table> # Blank Variable Handling[空白變量處理] There may be times when you want to print a default value for an empty variable instead of printing nothing, such as printing &nbsp; so that html table backgrounds work properly. Many would use an {if} statement to handle this, but there is a shorthand way with Smarty, using the default variable modifier. 有時候可能你想打印一個空變量的默認值,而不是空輸出,比如輸出“&nbsp;”(這是空格符號的實體,屬于HTML標記)以便表格背景能夠適當地工作。大多數人使用{if}語句來處理這類需要,但這里有一種Smatry的簡寫方法,那就是使用[default](#)變量調節器。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 提示 </caption> <tr><td>Note<br/> “Undefined variable” errors will show if PHP xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and a variable had not been assigned to Smarty.<br/> 如果php xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(這個是什么跟什么?),同時變量未分配給Smarty,那么會出現“Undefined variable”(變量未定義)錯誤。</td> </tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"><a name="AEN4181" id="AEN4181"/> <b>Example 18-1. Printing &amp;nbsp; when a variable is empty</b><br/><b>例 18-1.輸出&amp;nbsp;---如果一個變量是空值</b><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">&#13;{* the long way *}&#13; &#13; {if $title eq ""}&#13; &amp;nbsp;&#13; {else}&#13; {$title}&#13; {/if}&#13; &#13; &#13; {* the short way *}&#13; &#13; {$title|default:"&amp;nbsp;"}</pre></td></tr></table><p>參見<a href="language.modifier.default.html">default</a>調節器和<a href="tips.default.var.handling.html">默認變量處理</a>。</p></div></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="tips.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="tips.default.var.handling.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top"><p>Tips &amp; Tricks<br/> 使用技巧和經驗</p> </td><td width="34%" align="center" valign="top"><a href="appendixes.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top"><p>Default Variable Handling<br/> 默認變量處理</p> </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>

                              哎呀哎呀视频在线观看