Talk about the template selection in PHP program development

Source: Internet
Author: User
Tags mixed pear
The template for PHP is really a tricky thing to say. A random number of about 20 or more options, light pear contains 5 of different templates, it is really a headache.

Do not say that the good one, choose a template before the best to figure out what the real purpose of the template? Simply put, the core purpose of the template is a team work. There are two main modes of action:

1. Separating HTML and PHP makes it much more enjoyable for web designers and PHP programmers to collaborate.
 

2, the separation of display logic and the logic of things, so that the core transaction logic changes and application expansion is easier and more flexible, which means that the cooperation between programmers more enjoyable. (This is often overlooked or misunderstood, always think that the PHP out of the HTML is called separate display logic and logic of things, if so why did you let PHP and HTML mixed together? )

Figuring out what the real purpose of the template is, it's easy to make the right choice.
 

If you're the only PHP programmer who needs to work with other web designers, choose a template that separates HTML from PHP, Phplib (now seems to be integrated into Pear http://pear.php.net/package/ Html_template_phplib) or

Fasttemplate is such a thing, very simple easy to start.
 

If your website interface is ugly and mostly done by programmers, but the function is more complex and need powerful extension function, need to separate various levels including display logic, then do not use anything special, PHP itself is the best template. Note that in this case, you want to design your program very carefully, always remember to detach not PHP and HTML but transaction logic (business logic) and display logic (presentation logic). That's why I've always been very resistant to Smarty, because the Smarty syntax is so complex and powerful that it's almost reinventing a scripting language thing (even PHP programmers have to learn it again). More puzzling is that the more powerful the script, the easier it is to have the transaction logic (business logic) and display logic (presentation logic) mixed together, destroying the original intention of the template.
 

If you want to separate HTML from PHP, get a better visual design, and think that the entire system has a very powerful scalability to adapt to HTML,XML,WML interfaces, and that you don't have to learn complex syntax to provide high operational efficiencies, then this is a fairly challenging issue. The bad news is that there is no mature template to really achieve this requirement, the good news is that it is not difficult to complete such a template, if you have tried Zope or ColdFusion will find this template shadow,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.