Hello every body,
i want to know that what is php template class and how can i use it to reduce my work...
hope u guys will guide me in details....
Regards,
Azizi
PHP template class
Moderator: General Moderators
I'm not sure exactly what you're asking, but if you're looking for a cool templating system, check out Smarty: http://smarty.php.net/
It's very extensible and very handy. It's a bit tricky to get started, but, like other aspects of programming, once you get used to it it's pretty simple.
It's very extensible and very handy. It's a bit tricky to get started, but, like other aspects of programming, once you get used to it it's pretty simple.
Templating systems are a way to separate out the presentation layer - see http://www.phppatterns.com/index.php/ar ... ew/18/1/1/ for an intro to n-Tier.
Basically, a php script defines a bunch of vars, then these are echo'd out in a template. Presentation is controlled by the template and html is kept out of scripts. That makes for better programming in general and also allows html designers to do their thing without having to know any php.
A template could be a standard html file with a bunch of <?php echo $var; ?> statements.
In a template engine like smarty, custom placeholders are replaced with php when the template is parsed. Same sort of deal really - just slower.
Template engines do however have an important advantage in that you can prevent a designer from running php scripts. Not a problem for most of us but could be an issue on a large team project where privileges need to be restricted to the minimum.
Basically, a php script defines a bunch of vars, then these are echo'd out in a template. Presentation is controlled by the template and html is kept out of scripts. That makes for better programming in general and also allows html designers to do their thing without having to know any php.
A template could be a standard html file with a bunch of <?php echo $var; ?> statements.
In a template engine like smarty, custom placeholders are replaced with php when the template is parsed. Same sort of deal really - just slower.
Template engines do however have an important advantage in that you can prevent a designer from running php scripts. Not a problem for most of us but could be an issue on a large team project where privileges need to be restricted to the minimum.