First view results --
The page source code is as follows:
Analyze the code. After checking that the index_config.php (Smarty connection file) and index. php files are correct, let's take a look at the template file. The possible reason is that the tpl file generates the code --
Copy codeThe Code is as follows:
{% Config_load file = "1. conf" section = "style2" %}
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title >{% # title #%}</title>
</Head>
<Body bgcolor = "{%# bgcolor #%}" >{% $ hello %}
{% * This is a comment statement * %}
<Br/>
{% $ Array.0.0 %}
</Body>
</Html>
Smarty cannot parse the variables in the template file into the corresponding values. It must be an error when calling the file, but the code you write is correct, it is almost the same as the one on the book and on the Internet. How can I make a mistake ??
When I was puzzled, I suddenly found that when I called the variables, my code had more space than they did ..............................
Delete spaces, as shown in the following figure:
Page source code
In summary, when using the Smarty template, do not add spaces for the appearance and readability of the Code, so that Smarty will not parse these as variables, but will directly output