Introduction to simple installation and configuration of php smarty

Source: Internet
Author: User
Welcome to the Linux community forum and interact with 2 million technical staff. Go to php's smarty simple installation configuration Introduction: 1 first, download: 2 and then install: (1) unzip the file, copy the libs file to the root directory of the website and change it to smarty. (2) create four folders in the root directory: templates, templates_c, configs, cache; 3

Welcome to the Linux community forum, interact with 2 million technical staff> go to php's smarty simple installation configuration Introduction: 1 first, download: 2, install: (1) unzip the file, copy the libs file to the root directory of the website and change it to smarty. (2) create four folders in the root directory: templates, templates_c, configs, cache; 3

Welcome to the Linux community forum and interact with 2 million technicians>

Simple installation and configuration of php smarty:

1 first, download:

2. Then, install:

(1) decompress the file, copy the libs file to the root directory of the website, and rename it smarty;

(2) create four folders in the root directory: templates, templates_c, configs, and cache;

3. Finally, test:

(1) create a php file: text. php

  

Include_once ('smarty/smarty. class. php ');

Include_once ('smarty/config_file.class.php ');

Include_once ('smarty/smarty_compiler.class.php ');

$ Smarty = new Smarty;

$ Smarty-> template_dir = 'templates/'; // template storage directory

$ Smarty-> compile_dir = 'templates _ c/'; // compile the Directory

$ Smarty-> left_delimiter = "{"; // left delimiter

$ Smarty-> right_delimiter = "}"; // right delimiter

$ Smarty-> assign ('name', 'php self-learning net ');

$ Smarty-> assign ('title', 'Welcome to php self-learning Network !);

$ Smarty-> display ('index. tpl ');

?>

(2) create a tpl file under templates: index. tpl

  

  {{$ Title }}</pead>

  {$ Name }}

  

(3) Run test. php and the configuration is successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.