當(dāng)模板通過函數(shù) display() 或者 fetch()被調(diào)用時,它的輸出能夠通過一個或者多個濾鏡而發(fā)出。 它與預(yù)過濾器的不同之處就是預(yù)過濾器編譯模板是在模板保存到磁盤之前,輸出濾鏡是在它執(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ù)和設(shè)置 $autoload filters 變量來注冊或者從工具目錄里載入。SMARTY將傳遞模板輸出作為第一個參數(shù),通過自定義函數(shù)返回處理結(jié)果。
Example 15-4. using a template outputfilter -http://www.yiibai.com/smarty
|