Third, the method
L Assign: assigning variables to templates
L ASSIGNBYREF: Assigning variables to templates (passed by reference)
L Append: Append template variable to an array
L appendbyref: Append template variable to an array (passed by reference)
L Clearallassign
Clear all assigned variables
L ClearCache
Clear Cache
L Configload Load configuration file
In Smarty, load the configuration file in two ways:
1) in the template {config_load file= ' ... '}
2) $smarty->configload in the program ($file [, $section])
L Clearconfig
Clear all configuration file variables
L Display
Read, replace, output
L Fetch
Read, replace, return
L Templateexists: Determine if template exists
Attempting to load a non-existent template will cause an error and should be judged before the display
The difference between assign and Assignbyref:
the difference between display and fetch:
Four, filter
Filters are used to filter data
1, the type of filter:
1) Pre-filter prefilters
2) Rear Filter postfilters
3) Output filter outputs Filters
According to the different trigger time, the above three kinds of filters are divided.
2. Work Flow
TPL source file =〉prefilter =〉 Compile tpl file = = Postfilter = Save to disk + compiled PHP file execution =〉output Filters (=〉 If there is smarty cache, Output The content of the filters is cached) and the output of the result.
3. Register Filter
In smarty, filters must be registered before they are used
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 invoke different methods.
3.0, Register Filter
$smarty->registerfilter ($type, $callback);
$type: Filter Type
Range of values:
Pre: Preset Filter
Post: Post filter
Output: Export filter
$callback: Filter function
4. Code:
Pre-and post-filters are executed the first time the compilation occurs, or the template is changed and executed again
The output filter executes every time
The above describes the Php-smarty-7 (24), including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.