PHP smarty Template engine Basic installation

Source: Internet
Author: User
Tags smarty template

Environment: PHP5.2 or later

Go to the official website to download the Smarty Template engine library file to your computer or server

Smarty Official Website library files: https://www.smarty.net/download

Unzip to local after download is complete

Useful is the file inside the Libs folder, create a new smarty directory under your www directory, copy the Libs directory into the Smarty directory,

In particular, you need to note that your Templates_c folder must have writable permissions, if not, you can set the local to 777,

chmod 777 Templates_c

Then you also need to create four folders in the Smarty directory templates, Templates_c, cache, configs

Then enter the following code in your Smarty directory under index.php (create a new one yourself):

<? PHP     require (' Smarty.class.php ');        $smarty New Smarty;               $smarty->assign (' name ', ' Ryan ');     $smarty->display (' Index.tpl ');

Then create the Index.tpl file in the templates directory, the suffix name of this file is not fixed, you can be named according to your project.

Enter the following code in the TEMPLATES/INDEX.TPL:

    Hello, {$name}!  </body>

Open the browser, enter localhost/smarty/index.php see the following results indicate that the installation was successful.

PHP smarty Template engine Basic installation

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.