PHP code:------------------------------------------------- ----------------------------------
The following introduction is based on version 2.5. I don’t know if there are any BUGs. , the OS is win2000, php should be
4.1 or later. , Brother has only used it a few times during development, and has not done too much research.
The introduction can be found in the manual. Please forgive me if there are any mistakes.
The smarty template is said to be recommended by php.net , it is said that the function is relatively strong, and the speed is
not too slow. It is said that more and more people are using it
The official website smarty.php.net has forums, downloads, and manuals. There is everything you want, let’s get to the point:
(-) Installation:
After decompressing the downloaded package, there are three subordinate directories: the template file directory is
/app_1/smarty/libs
/app_1/smarty/templates_c
/app_1/smarty/templates
/app_1/smarty/configs
The above file names are smarty’s default file names. Users can specify different file names, such as: guest_template_dir, admin_template_dir, etc. If not Specify that the above file name will be used
(2) Use:
Design template:
1 Template variable: {$variable name}, such as {$color}, {$type}
test_color.tpl
{$name}
test_url.tpl
{$title}
2 You can also use template array
test_array.tpl
{people.name}
{people.sex}
{people.money}
3 template usage block list
such as:
user1 user1_sex user1_money
user2 user2_sex user2_money
user3 user3_sex user3_money
section.tpl
Can be formatted with tables:
{section name=user loop=$userList}
{$userList[user]. name}
{$userList[user].sex}