?
このドキュメントでは、 php中國語ネットマニュアル リリース
Smarty - the compiling PHP template engine | ||
---|---|---|
Prev 來源:PHP中文社區(qū) | Chapter 15. Advanced Features | Next |
Template prefilters are PHP functions that your templates are ran through before they are compiled. This is good for preprocessing your templates to remove unwanted comments, keeping an eye on what people are putting in their templates, etc. Prefilters 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 source code as the first argument, and expect the function to return the resulting template source code.
模板后過濾器是一些PHP函數(shù),模板就是在那些函數(shù)編譯后才運行。這樣有利于預(yù)先處理你的模板,刪除不不需要的內(nèi)容,監(jiān)視對模板進行的操作,例如:預(yù)過濾器同樣能夠通過 load filter() 函數(shù)和設(shè)置 $autoload filters 變量來注冊或者從工具目錄里載入。SMARTY將傳遞模板輸出作為第一個參數(shù),通過自定義函數(shù)返回處理結(jié)果。
Example 15-2. using a template prefilter
|
Prev | Home | Next |
Advanced Features | Up | Postfilters |