?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來源:PHP中文社區(qū) | Chapter 15. Advanced Features | Next |
When the template is invoked via display() or fetch(), its output can be sent through one or more output filters. This differs from postfilters because postfilters operate on compiled templates before they are saved to the disk, and output filters operate on the template output when it is executed.
當模板通過函數(shù) display() 或者 fetch()被調用時,它的輸出能夠通過一個或者多個濾鏡而發(fā)出。 它與預過濾器的不同之處就是預過濾器編譯模板是在模板保存到磁盤之前,輸出濾鏡是在它執(zhí)行的時候才操作模板輸出的。
Output filters can be either registered or loaded from the plugins directory by using load_filter() function or by setting $autoload_filters variable. Smarty will pass the template output as the first argument, and expect the function to return the result of the processing.
輸出濾鏡同樣能夠通過 load filter() 函數(shù)和設置 $autoload filters 變量來注冊或者從工具目錄里載入。SMARTY將傳遞模板輸出作為第一個參數(shù),通過自定義函數(shù)返回處理結果。
Example 15-4. using a template outputfilter
|
Prev | Home | Next |
Postfilters | Up | Cache Handler Function |