Home >PHP Framework >ThinkPHP >what is thinkphp template engine

what is thinkphp template engine

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-26 13:28:593950browse

what is thinkphp template engine

thinkphp template engine:

1. The template engine that comes with thinkphp5

It is basically the same as the template engine in tp3. The built-in template engine is an independently innovative XML compilation template engine.

Related recommendations: "ThinkPHP Tutorial"

2. twig template engine

Template engine twig templates are ordinary Text files do not need a special extension, .html .htm .twig are all acceptable. Variables and expressions in the template will be parsed and replaced at runtime, and tags will control the logic of the template.

3. Laravel Blade template engine

http://www.thinkphp.cn/extend/946.html

4. think-angular template engine

This template engine is written for PHP developers who can use angularjs. The main feature is that no additional tag definitions are required, all attribute definitions are used, and the template files are written and formatted in the IDE The code is very neat because the completed template file is still standard HTML.

https://www.kancloud.cn/shuai/php-angular

5. Smarty template engine

First go to Smarty official website to download A Smarty.
Next, unzip the compressed package and there will be two folders: demo and libs. Open the libs folder and copy all contents.
Next, open the thinkphp folder in the root directory of your website. There is a vendor folder inside. This folder is used by TP to call third-party libraries. Paste all the things you just copied.
After that, open the configuration file of your project, which should be the file conf.php in the conf directory of your project directory.

Add the following configuration:

'TMPL_ENGINE_TYPE'=>'Smarty'

If you want to configure more, you can also add

'TMPL_ENGINE_CONFIG'=>array(
'caching'=>true,
'template_dir'=>TMPL_PATH,
'compile_dir'=>CACHE_PATH,
'cache_dir'=>TEMP_PATH
)

so that you can use the Smarty template.

The file location of the template has not changed, nor has the cache location.

The above is the detailed content of what is thinkphp template engine. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn