Php-Smarty-7 (24), phpsmarty-724. Php-Smarty-7 (24), phpsmarty-724 3. method lassign: assign variables to the template lassignByRef: assign variables to the template (pass by reference) The difference between Display and fetch: 4. filter the php-Smarty-7 (24 ), phpsmarty-724
III. Methods
L assign: assign variables to the template
L assignByRef: assign variables to the template (pass by reference)
Difference between Display and fetch:
IV. filter
A filter is used to filter data.
1. filter types:
1) prefilter Prefilters
2) Postfilters
3) Output filter Output Filters
Based on the trigger time, the above three filters are divided
2. workflow
Tpl source file => Prefilter => compile tpl file => Postfilter => save to disk => run the compiled PHP file => Output Filters (=> if there is a smarty cache, output Filters content will be cached) => result Output.
3. Register a filter
In Smarty, the filter must be registered before use
In 2.6, register the filter
L Prefilters
$ Smarty-> register_prefilter ("func ");
L Postfilters
$ Smarty-> register_postfilter ("func ");
L Output Filters
$ Smarty-> register_outputfilter ("func ");
Register different filters to call different methods.
3.0, register the filter
$ Smarty-> registerFilter ($ type, $ callback );
$ Type: filter type
Value range:
Pre: Pre-filter
Post: Post filter
Output: Output filter
$ Callback: filter function
4. Code:
The pre-filter and post-filter will be executed during the first compilation, or the template will be executed again after the template changes.
The output filter is executed every time.
Http://www.bkjia.com/PHPjc/995278.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/995278.htmlTechArticlephp-Smarty-7 (24), phpsmarty-724 3. method lassign: assign variables to the template lassignByRef: assign variables to the template (pass by reference) The difference between Display and fetch: 4. filter...