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: 2838096 |
Download: 218 |
Latest Downloads
Red Alert Online
Delta Force
Pokémon UNITE
Fantasy Aquarium
Girls Frontline
Wings of Stars
Little Flower Fairy Fairy Paradise
Restaurant Cute Story
Shanhe Travel Exploration
Love and Producer
24 HoursReading Leaderboard
- 1 Can SQL Injection Bypass `mysql_real_escape_string()` Using Character Set Manipulation?
- 2 Why Use Unnamed Arguments in Go Functions?
- 3 Why Isn't My PHP Mail Function Sending Emails?
- 4 Comprehensive Guide to Loops in JavaScript
- 5 Why Does My Selenium Chrome Test Fail with a NoSuchElementException While Working in Firefox?
- 6 Why does this vulnerability exist? CVE-WPForms)
- 7 How to Reliably Expire a PHP Session After 30 Minutes of Inactivity?
- 8 Is There a Better Alternative to Using the DUAL Table in Oracle for SELECT Statements Without a FROM Clause?
- 9 How Do Curly Braces Enable Complex String Interpolation in PHP?
- 10 How Can I Replicate the `pointer-events` CSS Property in Internet Explorer?
- 11 Luma Island: How To Repair The Lighthouse
- 12 How Can I Remove the IE10 Input Field Clear Button Using CSS?
- 13 How Do Goroutines Maintain Concurrency During System Calls with a Single OS Thread?
- 14 How Can I Create Multiline Strings in JavaScript?
- 15 Can HTML's "\n" Create Line Breaks, or Do We Need `` Tags?
Latest Tutorials
-
- Go language practical GraphQL
- 2347 2024-04-19
-
- 550W fan master learns JavaScript from scratch step by step
- 3766 2024-04-18
-
- Getting Started with MySQL (Teacher mosh)
- 2006 2024-04-07
-
- Mock.js | Axios.js | Json | Ajax--Ten days of quality class
- 2787 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