PHP Smarty First Experience Two get configuration information _php Tutorial

Source: Internet
Author: User
Tags smarty template
Look at the results first--

The page source code is as follows:

Analysis of the code, after checking index_config.php (smarty Connection file), index.php files are error-free, the following focus on the template file, perhaps the reason is on this TPL file, out of the code--
Copy the Code code as follows:
{% config_load file= "1.conf" section= "Style2"%}



{% #title #%}

{% $hello%}
{%* This is a comment statement *%}


{% $array. 0%}



Smarty cannot parse the variables in the template file into corresponding values, it must be the wrong call to the file, but look at the code is also true Ah, and the book, online almost the same, how can be wrong??

At the time of baffled, it was suddenly discovered that their code was more space than they were when they called the variables ........ ..........

Delete space, done:

Page source code

Summary, when using the Smarty template, do not add space for the beauty and readability of the code, so that Smarty will not interpret these as variables, and will directly output

http://www.bkjia.com/PHPjc/324019.html www.bkjia.com true http://www.bkjia.com/PHPjc/324019.html techarticle First Look at the results-the page source code is as follows: Analysis of the code, after checking index_config.php (smarty Connection file), index.php files are error-free, the following focus on the template file, can ...

  • 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.