The PHP template is indeed easy to say and do. There are more than 20 options for a random number. pear contains 5 different templates, which is really a headache. Never let everyone say that this is a good thing. before you select a template, you 'd better find out what the real purpose of the template is? Simply put, the core purpose of a template is to develop a t program.
The PHP template is indeed easy to say and do. There are more than 20 options for a random number. pear contains 5 different templates, which is really a headache.
Never let everyone say that this is a good thing. before you select a template, you 'd better find out what the real purpose of the template is? Simply put, the core purpose of a template is a team work. There are two main ways to work:
1. separating HTML and PHP makes it easier for web designers to cooperate with PHP programmers.
2. the separation of display logic and Transaction logic makes it easier and more flexible to change the core transaction logic and extend the application. that is to say, it makes the cooperation between programmers more pleasant. (This is often overlooked or misunderstood. I always think that the separation of display logic and Transaction logic is to extract PHP from HTML, if so, why should PHP and html be mixed together ?)
It is easy to make the right choice by figuring out what the real purpose of this template is.
If you have only one php programmer but need to work with other web designers, you can select a template that can separate HTML and PHP, phplib (now seems to have integrated http://pear.php.net/package/HTML_Template_PHPLIB into Pear) or
FastTemplate is easy to use.
If your website interface is ugly and mainly completed by programmers, but the functions are complicated and more powerful extension functions are required, you need to separate all layers including the display logic, so don't use anything special. PHP itself is the best template. Note that in this case, you must design your program very seriously and always remember that what you want to separate is not PHP and html but business logic) and presentation logic ). This is why I have always been very resistant to something like Smarty, because the syntax of this Smarty is too complicated and too powerful, and almost re-invented a scripting language, (Even PHP programmers have to learn it again ). What is even more confusing is that the more powerful the script, the more likely it is to mix the Transaction logic and the presentation logic, undermining the original intention of the template.
If you want to separate HTML from PHP, get a better visual design, and have a very powerful extension capability for the entire system to adapt to various html, xml, and wml interfaces, and you don't need to learn complex syntaxes and provide high running efficiency. this is a very challenging problem. Bad news is that no mature template can really meet this requirement. The good news is that it is not difficult to complete such a template, if you try Zope or ColdFusion, you will find the shadow of this template,
(Wact http://wact.sourceforge.net/and phptal http://phptal.sourceforge.net/is developing in this direction and should be promising ).
There are two main ways to combine templates and data (Template calling): push and pull.
The push method is to use PHP to push data to the template. that is to say, the programmer needs to assign values to every variable in the template and bind them.
The pull method is like mixing php and html, and the template variables actively drag in the data.
When it comes to templates, there are two other things that cannot be mentioned:
Phphtmllib and quickform (http://pear.php.net/package/HTML_QuickForm) are two kinds of things: the traditional way to complete the construction of the whole page of HTML pages through various page components, and then the programmer's hand, many programmers who have compiled traditional GUI desktop programs prefer this method.
More beautiful solutions
If you are using commercial software, Flash should be a more beautiful solution (do not make a mistake, do not think that you know that php supports the ming and swf libraries to dynamically generate Flash, I am not talking about this .) What I want to talk about is the scheme that supports Flash Remoting. this kind of thing is a truly meaningful combination of PHP and flash. The flash part is completed by the visual designer. The PHP programmer sends the data to the flash client through flash remoting.
There are currently two solutions:
AMFPHP
Http://www.amfphp.org/
Because Macromedia Flash Remoting uses a unique and more efficient data format for data transmission, AMFPHP constructs a php class on the server to receive the data by analyzing the data format, parse and encode the data to enable information exchange (like Samba, it should belong to Hacking ).
PHPObject
Http://ghostwire.com/resources/phpobject/
PHPObject uses another method to embed some actionscript components in flash to transmit data through open-format soap.
In fact, PHP templates involve many other issues. at half past one, I can only write so much.