<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="plugins.compiler.functions.html" accesskey="P">Prev</a></td><td width="50%" align="center" valign="bottom">Chapter 16. Extending Smarty With Plugins<br/></td><td width="25%" align="right" valign="bottom"><a href="plugins.outputfilters.html" accesskey="N">Next</a></td></tr></table> # Prefilters/Postfilters[預濾器/后濾器] Prefilter and postfilter plugins are very similar in concept; where they differ is in the execution -- more precisely the time of their execution. 從概念上看,預濾器和后濾器插件很相似;不同之處就在于它們的執行,更確切地說是它們的執行時刻。 > string smarty_prefilter_name($source, &$smarty); > string $source; > object &$smarty; Prefilters are used to process the source of the template immediately before compilation. The first parameter to the prefilter function is the template source, possibly modified by some other prefilters. The plugin is supposed to return the modified source. Note that this source is not saved anywhere, it is only used for compilation. 預濾器用來在編譯之前直接處理模板資源(源文件)。預濾器函數的第一個參數是模板資源,該文件可能被其他預過濾器處理過。此插件將返回修改過的資源。請記住此資源僅用來編譯,它不會在任何地方被保存。 > string smarty_postfilter_name($compiled, &$smarty); string $compiled; object &$smarty; Postfilters are used to process the compiled output of the template (the PHP code) immediately after the compilation is done but before the compiled template is saved to the filesystem. The first parameter to the postfilter function is the compiled template code, possibly modified by other postfilters. The plugin is supposed to return the modified version of this code. 后過濾器用在編譯完成后,編譯模板保存到文件系統前,立即處理模板的編譯輸出(PHP代碼)。預過濾器函數的第一個參數是編譯之后的模板代碼,該代碼可能被其他后過濾器處理過。后濾器插件將返回處理過的php代碼譯本。 <table width="80%" border="0" cellpadding="2" cellspacing="2" class="note"><caption> 譯注 </caption> <tr><td>模板、預過濾器、編譯、后過濾器、保存編譯的關系應該是這樣的:<br/><img src="https://box.kancloud.cn/2015-09-02_55e669a1b872f.gif"/></td> </tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"><a name="AEN4167" id="AEN4167"/><b>Example 16.7. prefilter plugin<br/>例16-7.預濾器插件</b><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">&lt;?php/* * Smarty plugin * ------------------------------------------------------------- * File: prefilter.pre01.php * Type: prefilter * Name: pre01 * Purpose: Convert html tags to be lowercase. * ------------------------------------------------------------- */ function smarty_prefilter_pre01($source, $smarty) { return preg_replace('!&lt;(\w+)[^&gt;]+&gt;!e', 'strtolower("$1")', $source); }?&gt;</pre></td></tr></table></div></td></tr></table> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="EXAMPLE"><tr><td><div class="EXAMPLE"> <p><b>Example 16.8. postfilter plugin<br/>例16-8.后濾器插件</b></p> <table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="PROGRAMLISTING">&lt;?php/* * Smarty plugin * ------------------------------------------------------------- * File: postfilter.post01.php * Type: postfilter * Name: post01 * Purpose: Output code that lists all current template vars. * ------------------------------------------------------------- */ function smarty_postfilter_post01($compiled, $smarty) { $compiled = "&lt;pre&gt;\n&lt;?php print_r(\$this-&gt;getTemplateVars()); ?&gt;\n&lt;/pre&gt;" . $compiled; return $compiled; }?&gt;</pre></td></tr></table><p> 參見<a href="api.registerfilter.html">registerFilter()</a>和<a href="api.unregisterfilter.html">unregisterFilter()</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="plugins.compiler.functions.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="plugins.outputfilters.html" accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Compiler Functions<br/> 編譯函數</td><td width="34%" align="center" valign="top"><a href="plugins.html" accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Output Filters<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>

                              哎呀哎呀视频在线观看