A brief discussion on template selection in PHP program Development _php Tutorial

Source: Internet
Author: User
Tags pear
The template for PHP is really a hassle-prone thing to say. A random number of about 20 kinds of choices, light pear inside contains 5 different templates, it really makes people headache.
 
Do not say that this good bad, choose the template before the best to figure out what is the real purpose of the template? To put it simply, the core purpose of a template is a team work. There are two main ways of acting:
1. Separating HTML from PHP makes it more enjoyable for web designers to work with PHP programmers.
 
2. Separating the display logic and the logic of things makes the change of the core transaction logic and the extension of the application easier and more flexible, that is to say, makes the cooperation between programmers more enjoyable. (This is often overlooked or misunderstood, always thought to get PHP out of the HTML is called separation display logic and the logic of things, if so why do you want to let PHP and HTML mixed together?) )
Figuring out what the real purpose of this template is, it's easy to make the right choice.
 
If you are only a PHP programmer but need to work with other web designers, then choose a template that separates HTML and 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 and easy to get started.
 
If your Web site interface is ugly and mainly by the programmer to complete, but the function is more complex and need powerful extension function, need to separate all levels including display logic, then do not use anything special, PHP itself is the best template. Note that in this case, you should design your program very carefully and always remember that it is not PHP and HTML but the transaction logic (business logic) and the display logic (presentation logic) that you want to separate. That's why I've always been very resistant to Smarty, because this Smarty syntax is too complex to be powerful, almost reinventing a scripting language, (even PHP programmers have to re-learn it). More puzzling is the more powerful the script, the easier it is for people to mix transaction logic (business logic) and display logic (presentation logic), destroying the original intent of the template.
 
If you want to separate HTML and PHP, get a better visual design, and think that the whole system has a very strong ability to adapt to html,xml,wml various interfaces, and not to learn complex syntax while providing high operational efficiency, then this is a very challenging problem. The bad news is that there is not yet a mature template that can really meet 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 the shadow of this template,
(Wact http://wact.sourceforge.net/and Phptal http://phptal.sourceforge.net/are developing in this direction and should be very promising).

http://www.bkjia.com/PHPjc/445217.html www.bkjia.com true http://www.bkjia.com/PHPjc/445217.html techarticle the template for PHP is really a hassle-prone thing to say. A random number of about 20 kinds of choices, light pear inside contains 5 different templates, really makes people headache ...

  • 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.