The Smarty template and tpl show that the problem is that the Smarty template is learned at the beginning. All other configurations can be successful, but the first test program cannot be properly displayed & nbsp; index. php content: & nbsp; & lt ;? Php & nbsp; * load the configuration file * to ensure that the config file is correctly configured ..... Include. config. php; * sound Smarty template, tpl display problems
When I first started learning the Smarty template, all other configurations were successful, but the first test program could not be properly displayed.
Content in index. php ::
/* Load the configuration file */You can confirm that the configuration of the config file is correct .....
Include '../config. php ';
/* Declare an array */
$ Arr = array ('computerbook', 'name' => 'php advanced phase ', 'unit _ price' => array ('price' =>' $65.00 ', 'Unit '=> 'bene '));
/* Pass the title and array to the template */
$ Smarty-> assign ('title', 'Use Smarty to read the array ');
$ Smarty-> assign ('arr', $ arr );
/* Template page to be displayed */
$ Smarty-> display ('02/index. tpl ');
?>
Index in the tpl template file:
{% $ Title %}
Book purchase information:
{% * Obtain the first element value of the array using the index * %}
Book Category: {% $ arr [0] %}
{% * Use the key value to obtain the second array element value * %}
Book name: {%$ arr. name %}
{% * Use the key value to obtain the element value of the two-dimensional array * %}
Unit Price: {% $ arr. unit_price.price %}/{% $ arr. unit_price.unit %}
When accessed in a browser, the following output is displayed directly on the webpage:
Book purchase information:
{% * Obtain the first element value of the array using indexes * %} Book Category: {% $ arr [0] %}
{% * Use the key value to obtain the second array element value * %} book name: {% $ arr. name %}
{% * Use the key value to obtain the element value of the two-dimensional array * %} unit price: {% $ arr. unit_price.price %}/{% $ arr. unit_price.unit %}
Hope answers
------ Solution --------------------
What address did you access?
------ Solution --------------------
You can directly access the template page.
------ Solution --------------------
Are you accessing the index. php page? $ Smarty-> display ('02/index. tpl ');
Displayed template file