MVC is a development model that emphasizes the forced separation of data input, processing, and display.
Smarty usage tutorial
1. How to configure our smarty
After unzipping, place the libs folder in the first-level directory of the website, and then create two folders
templates stores template files
templates_c stores compiled files
Create the initialization file smarty.ini.php again
Note:
1. Generally use <{}>
as the identifier separator for replacement variables.
Two ways to change the delimiter:
1. Change the source code: Smarty.class.php $left_delimiter Not recommended
2. Dynamic modification:
$Smarty->left_delimiter="<{";
$Smarty->right_delimiter="}>";
written before display
2.smarty allocates data
$smarty->assign("Address",$address);
Used to assign values to templates. You can specify a name/number pair or an associative array containing name/numbers.
$smarty->assign("aa",true); //Output 1
$smarty->assign("aa",false); //Output is empty
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn