?
? ????? PHP ??? ???? ??? ?? ??
Prefilter and postfilter plugins are very similar in concept; where
they differ is in the execution -- more precisely the time of their
execution.
從概念上看,預(yù)濾器和后濾器插件都很簡單;不同之處就在于它們的執(zhí)行,更確切地說是它們的執(zhí)行時(shí)刻(非時(shí)間段,而是某一個(gè)時(shí)刻)。
string smarty_prefilter_
name
(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.
預(yù)濾器用來在編譯之前直接處理模板源文件。預(yù)濾器函數(shù)的第一個(gè)參數(shù)是模板源文件,該文件可能被其他一些預(yù)濾器修正過。此預(yù)濾器插件將返回修正過的源文件。請記住此源文件僅用來編譯,它不會(huì)在任何地方被保存。
string smarty_postfilter_
name
(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代碼),但須在編譯之后的模板被保存到文件系統(tǒng)之前就進(jìn)行操作。預(yù)濾器函數(shù)的第一個(gè)參數(shù)是編譯之后的模板代碼,該代碼可能被其他一些后濾器修正過。此后濾器插件將返回修正過的代碼文件。
Example 16-7. prefilter plugin預(yù)濾器插件
|
Example 16-8. postfilter plugin后濾器插件
|