lovefc_Template is a small, lightweight, and efficient template engine. It is only a dozen kilobytes in size. It provides the most basic functions of a template engine. In addition, there are some scalability for template languages. You can take advantage of it. to create your own template code and write code faster and more conveniently.
Smarty is the most classic template engine. I believe many people have used it. However, it is too big. In some projects that are not very large, using it is not worth the gain.
There are many other similar template engines on the market, all of which are mainly lightweight. The advantage of lovefc_Template is that its conversion method is not through simple regular matching, and some of its syntax is also very convenient.
For example, many template codes do not have assignment syntax. Lovefc_Template defines an assignment syntax.
{($a='Hello')}
The assignment here is the same as in php, whether it is a function, array, or object, {($obj=newobj())}{($array=array(1=>'a')) }
The delimiter here is {(and)}. We do not recommend you to use {} because it may cause errors.
It also has a powerful template language for file references
{(includefile="template file name")}
Support other directory templates. Or it can be the path of a file. The file will be intelligently judged and referenced for compilation. During compilation, these tasks will be completed automatically and will not be executed in the compiled file, which improves the efficiency of future execution.
It’s also worth mentioning that you can use its regular replacement function to create your own template code
For example, set
$fc->se=array('#[include((.*))]#isuU');
$re->re=array('{(includefile="\1")}');
This way you can use it directly in the template
[include(foot)]
is equivalent to
{(includefile="foot")}
In addition to supporting template code replacement, other regular expressions are also supported.
You can set up your own template code without sticking to the existing methods.
This will not have any impact on efficiency. The result after compiling into a compiled file is exactly the same. In addition, it also supports regular function replacement.
It is a lightweight template and may not have the features you want. But don't be discouraged, the author will keep updating. .
Whether you are embedding it when developing a framework or quickly developing an application, you can use it to reduce your work and make the original mixed HTML and PHP code easier to read and modify.
It contains an introduction and update process, which can be run directly in the PHP environment. Please pay attention to the read and write permissions of the relevant folders. If you have any questions, you can contact the author.