?
Ce document utilise Manuel du site Web PHP chinois Libérer
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來(lái)源: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.
當(dāng)模板通過(guò)函數(shù) display() 或者 fetch()被調(diào)用時(shí),它的輸出能夠通過(guò)一個(gè)或者多個(gè)濾鏡而發(fā)出。 它與預(yù)過(guò)濾器的不同之處就是預(yù)過(guò)濾器編譯模板是在模板保存到磁盤(pán)之前,輸出濾鏡是在它執(zhí)行的時(shí)候才操作模板輸出的。
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.
輸出濾鏡同樣能夠通過(guò) load filter() 函數(shù)和設(shè)置 $autoload filters 變量來(lái)注冊(cè)或者從工具目錄里載入。SMARTY將傳遞模板輸出作為第一個(gè)參數(shù),通過(guò)自定義函數(shù)返回處理結(jié)果。
Example 15-4. using a template outputfilter
|
Prev | Home | Next |
Postfilters | Up | Cache Handler Function |