<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                <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.function.call.html" accesskey="P">Prev</a></td> <td width="50%" align="center" valign="bottom">Chapter 7. Built-in Functions[第七章.內置函數]</td> <td width="25%" align="right" valign="bottom"><a href="language.function.config.load.html" accesskey="N">Next</a></td></tr></table> # {capture}捕獲 {capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. The captured content can be used in the template from the variable $smarty.capture.foo where “foo” is the value passed in the name attribute. If you do not supply the name attribute, then “default” will be used as the name ie $smarty.capture.default. {capture}'s can be nested. {capture}用來捕獲模板輸出的數據并將其存儲到一個變量里,而不是將它們輸出到頁面。任何在{capture name="foo"}和{/capture}之間的數據將被存儲到變量$foo中,該變量由*name*屬性指定。 在模板中,可以通過$smarty.capture.foo訪問{capture}內容,‘foo’是傳遞給*name*屬性的值。如果沒有提供name屬性,函數默認將使用 "default" 作為參數,例如$smarty.capture.default。 {capture}可以嵌套。 **Attribute:** | Attribute Name | Type | Required | Default | Description | |-----|-----|-----|-----|-----| | name | string | yes | *default* | The name of the captured block | | assign | string | No | *n/a* | The variable name where to assign the captured output to | | append | string | no | n/a | The name of an array variable where to append the captured output to | **Option Flags: ** | Name | Description | |-----|-----| | nocache | Disables caching of this captured block | **屬性:** | 屬性 | 類型 | 是否必須 | 缺省值 | 描述 | |-----|-----|-----|-----|-----| | name | string | yes | *default* | 數據捕獲區域名稱 | | assign | string | no | *n/a* | 變量名,用來指定捕獲的輸出分配到哪里 | | append | string | no | n/a | 數組變量,用來聲明捕獲的輸出(存貯)追加到哪里 | **選項標記: ** | 名稱 | 描述 | |-----|-----| | nocache | 捕獲的區域禁止緩存 | <table width="80%" border="0" align="center" cellpadding="2" cellspacing="2" class="warning"><th>警 告 </th> <tr><td><p>Caution<br/> Be careful when capturing {insert} output. If you have $caching enabled and you have {insert} commands that you expect to run within cached content, do not capture this content.</p> <p>當捕獲<a href="language.function.insert.html">{insert}</a>輸出時要非常小心!如果你開啟了$caching緩存,希望在緩存內容里運行{insert}命令。那么,請不要捕獲{insert}里面的內容!因為{insert}內容總是不被緩存。</p></td> </tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"> <a name="AEN721" id="AEN721"> </a> <b>Example 7.21. {capture} with the name attribute<br/> 例 7-21.{capture}的name屬性</b> <table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">{* we don't want to print a div tag unless content is displayed *}{* 我們不想輸出一個div標簽,除非包含的內容是無法顯示的 *}{capture name="banner"}{capture "banner"} {* short-hand *} {include file="get_banner.tpl"}{/capture}{if $smarty.capture.banner ne ""}&lt;div id="banner"&gt;{$smarty.capture.banner}&lt;/div&gt;{/if}</pre> </td> </tr></table></div></td> </tr></table> **Example 7.22. {capture} into a template variable** **例 7-22.{capture}內容分配給變量** | ~~~ This example demonstrates演示 the capture function.{capture name=some_content assign=popText}{capture some_content assign=popText} {* short-hand *}The server is {$my_server_name|upper} at {$my_server_addr}<br>Your ip is {$my_ip}.{/capture}<a href="#">{$popText}</a> ~~~ | |-----| **Example 7.23. {capture} into a template array variable** **例 7-23.捕獲模板內容** | ~~~ This example also demonstrates how multiple calls of capture can be used to create an array with captured content. 這個示例演示了多重調用capture是如何利用捕獲的內容組成一個數組的。{capture append="foo"}hello{/capture}I say just {capture append="foo"}world{/capture}{foreach $foo as $text}{$text} {/foreach} The above example will output:I say just hello world ~~~ | |-----| See also $smarty.capture, {eval}, {fetch}, fetch() and {assign}. 參考[$smarty.capture](#)、[{eval}](#)、[{fetch}](#)、[fetch()](#)和[{assign}](#)。 <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="language.function.call.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.function.config.load.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">{call}<br/> 調用</td><td width="34%" align="center" valign="top"><a href="language.builtin.functions.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">{config_load}<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>

                              哎呀哎呀视频在线观看