current location: Home > Download > Learning resources > php e-book > php smarty template tutorial
php smarty template tutorial
Classify: Learning materials / php e-book | Release time: 2018-02-22 | visits: 2838067 |
Download: 218 |
Latest Downloads
Fantasy Aquarium
Girls Frontline
Wings of Stars
Little Flower Fairy Fairy Paradise
Restaurant Cute Story
Shanhe Travel Exploration
Love and Producer
The most powerful brain 3
Odd Dust: Damila
Young Journey to the West 2
24 HoursReading Leaderboard
- 1 How to Convert a Naive Datetime Object to an Aware Datetime Object in Python?
- 2 How to Properly Validate Arrays in Laravel?
- 3 Disney Dreamlight Valley: Hades Character Guide
- 4 Stalker 2 Trader locations
- 5 Is Daylight Saving Time in Effect? Detecting DST Accurately in JavaScript.
- 6 How Can I Efficiently Group NumPy Arrays?
- 7 Is `is None` or `== None` the Right Way to Check for Null in Python?
- 8 Why is my clipped background image unexpectedly cropped when using `background-size: cover` and `background-attachment: fixed`?
- 9 How to Properly Use Prepared Statements with PDO for MySQL INSERT Queries?
- 10 How Can I Efficiently Get a List of Values from a Python Dictionary?
- 11 .so vs. .dylib on macOS: What\'s the Difference?
- 12 How Can I Silently Remove the \"Image Not Found\" Icon from My Website?
- 13 How Can I Accurately Shift Decimal Places in Doubles While Minimizing Rounding Errors?
- 14 Why Doesn\'t Maven Find My JUnit Tests?
- 15 Why is my JAR Bundler application lagging or terminating when using OSXAdapter?
Latest Tutorials
-
- Go language practical GraphQL
- 2143 2024-04-19
-
- 550W fan master learns JavaScript from scratch step by step
- 3575 2024-04-18
-
- Getting Started with MySQL (Teacher mosh)
- 1878 2024-04-07
-
- Mock.js | Axios.js | Json | Ajax--Ten days of quality class
- 2686 2024-03-29
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