Smarty is a template engine for PHP. :\`o8`
More specifically, it facilitates a manageable way to separate application logic and content from its presentation. zOAd~E
This is best described in a situation where the application programmer and the template designer play different roles, or in most cases are not the same person. Hh3X
\
For example, let's say you are creating a web page that is displaying a newspaper article. The article headline, tagline, author and body are content elements, they contain no information about how they will be presented. They are passed into Smarty by the application, then the template designer edits the templates and uses a combination of HTML tags and template tags to format the presentation of these elements (HTML tables, background colors, font sizes, style sheets, etc.) iJI }TVep#
One day the programmer needs to change the way the article content is retrieved (a change in application logic.) This change does not affect the template designer, the content will still arrive in the template exactly the same. I3{PZhU.
Likewise, if the template designer wants to completely redesign the templates, this requires no changes to the application logic. Therefore, the programmer can make changes to the application logic without the need to restructure templates, and the template designer can make changes to templates without breaking application logic. CAig]=2'
Wq D4YGN
Smarty是一个php模板引擎. 2G& a{
更准确的说,它分开了逻辑程序和外在的内容,提供了一种易于管理的方法 9rA0lqr]5
可以描述为应用程序员和美工扮演了不同的角色,因为在大多数情况下 ,他们不可能是同一个人. "+R+6<