ThinkPHP uses smarty template engine_PHP tutorial

WBOY
Release: 2016-07-13 10:26:24
Original
867 people have browsed it

ThinkPHP supports a variety of php template engines, which can be configured according to personal needs.
Let's take the Smarty template engine as an example to explain the specific operation process!

First go to the Smarty official website to download a Smarty. Download address of this website: http://www.jb51.net/codes/16086.html.
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.
Then 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'
Copy after login

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 
)
Copy after login

This way you can use Smarty templates.

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824706.htmlTechArticleThinkPHP supports a variety of php template engines, which can be configured according to personal needs. Let's take the Smarty template engine as an example to explain the specific operation process! First go to the Smarty official website...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!