PHP template engine PHP development programs are usually mixed with php code and html. so what's the problem?
First, it is not conducive to division of labor and cooperation. Generally, programmers write code to design the webpage by the artist. In this way, the programmer must wait for the artist to design the interface to start working. That is to say, the work of programmers and artists cannot be synchronized.
Second, it is not conducive to maintenance and has poor maintainability. For example, to modify the interface after the program is fixed, the programmer must modify the interface and then add it again.
Finally, the program structure is messy and the readability is poor. HTML and PHP are mixed together, and once there are more than one program, it will become very messy.
The template technology emerged to solve these problems. to solve these problems, the first thing that emerged was the template technology using php labels.
1. interpreted PHPLIB
(1) procedures
$ T = new Template ()
$ T-> set_file
$ T-> set_var
$ T-> parse
$ T-> p
Translate to Chinese
Initialize template class $ t set template file set template variable analysis template file template variable output content
At least five steps are passed to implement template processing in the php program.
(2) processing loop nesting:
{It}
2. Compile-type Smarty program processing process
(1) procedures:
$ S = new Smarty
$ S-> assign
$ S-> display
Translate to Chinese
Initialize template class settings template variable parsing and output Template
(2) processing loop nesting:
<{Section name = loopName loop = $ loopArray}> (for example, foreach)
Summary:
PHP does not require a very proficient syntax. PHP does not require you to develop many libraries on your own. PHP does not require you to worry about the features of languages such as performance and stability.
What PHP needs is your logic; what PHP needs is your creativity; what PHP needs is your thoughts !!!