The features of the Smarty template determine its superiority, which is also the reason why PHPer is sought after (more importantly, most of the recruitment requirements). Today, I roughly read the basic usage of Smarty, however, it was useless to watch it. I tried it at noon, but it turned out to be a small problem, which caused me no time to go to bed at noon.
The features of the Smarty template determine its superiority, which is also the reason why PHPer is sought after (more importantly, most of the recruitment requirements). Today, I roughly read the basic usage of Smarty, however, it was useless to watch it. I tried it at noon, but it turned out to be a small problem, which caused me no time to go to bed at noon.
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 --
The Code is as follows:
{% Config_load file = "1. conf" section = "style2" %}
{% # Title # %}
{% $ Hello %}
{% * This is a comment statement * %}
{% $ Array.0.0 %}
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