Basic construction of Template Smarty template for Smarty

Source: Internet
Author: User
Tags smarty template
1, download Smarty template, the official has

2, decompression can, you will have such a directory

In addition to the Libs folder can be deleted (do not know what is the use).

3, in the current directory to create templates, Templates_c, Cache, config folder, other names can also, but need to modify the configuration file

4. Create a folder in the root directory call anything, create a php file, paste the following code into it.

Require_once ("libs/smarty.class.php");
$smarty =new smarty ();
$smarty->template_dir= "Templates";//Specify the path to the template file
$smarty->compile_dir= "Templates_c";//Specify the file path of the compilation
$smarty->cache_dir= "Cache";//Specify Cache file path
$smarty->c C/>


<{$name}>



6, run the PHP file, he absolutely pen error like this

Because of the configuration file path problem, it is better to do so, because the file is not executed in the root directory, so will report this error.

7, the most basic smarty framework is completed, mainly the path of the problem will make mistakes, if it is the following error

This means there is no problem with the introduction of the file, but the configuration is wrong like this, the novice is easily blindfolded.

The above describes the Smarty template Smarty Template Foundation, including the content of the Smarty template, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.