I think Smarty is still relatively simple, but the feeling is still a little trouble, Smarty is the template engine, my personal understanding, it is to separate the output of the code content and style.
Smarty compile-time processing is the source PHP file, template file (may call multiple or more than one), source PHP file ... This means that the original PHP file is not affected by other processing and output. So the Smarty template file can be either full HTML or part of it. Smarty processing process smarty PHP source files, first compiled into intermediate files (also PHP), if the cache is enabled, and then according to the compilation file generated cache files (also PHP), the part that needs to be cached is all hard-coded. Each subsequent visit accesses the compiled file (if it already exists), compiles multiple calls at a time (which can be multiple times of a single file, or multiple files), and if caching is enabled and the cache file is not expired, the cache file is accessed directly and the compiled file is skipped. Once the compiled file is generated, it will not be automatically updated unless the template file or configuration file changes. The source PHP file modification does not cause recompilation. Once the compilation file is regenerated, the cache file will inevitably regenerate.
We can build different PHP source files folder, put the PHP files written in a certain category in different folders. Then create a custom config file in each folder, create a new $smarty in the config file, and then put all the different folders of the PHP file cache, config file, plugin, template, compile directory are set to the same cache, Config file, plugin, template, compile directory so that all PHP source files under this folder can refer to the configuration file to get the same configuration
A little understanding of smarty