What is a smarty plugin?
Follow the original system rules, can call system functions and so on;
Strong portability, no impact on the original system;
is essentially a function;
Smarty Common plug-in types
1.functions function Plug-in
2.modifiers modifier plug-in
3.block functions block Function plugin
How do I make and use plugins? Three ways:
1. Registering a custom function with Registerplugin ()
2. Put the written plug-in into the plugins directory under the Smarty extracted Lib directory
3.PHP built-in functions that can be automatically used in templates in the form of a modifier plug-in (variable adjuster plug-in)
Functions plug-in use
1. Create a plug-in file in the plugins directory
This file is a php file with a fixed name format: function. plug-in name. php
Attention:
The name of the plug-in, which is the name of the function;
A plug-in file that contains only one function, which has the same name as the plug-in name;
Code for function writing in plug-in files:
When calling a function in a template, write the function name directly, and the custom function is the same
{test_area width= ' height= ' 300 '}
View Engine Smarty Plugin