I have read several tutorials and 'philosophical' views aon writting PHP codes by either implementing templates or making your own templates. So me says template engines are like learning new language, som e say are good. Good controversy!

What do you suggest guys, I mean pros and cons of each plus your recommendation.

Thanks :)

Recommended Answers

All 4 Replies

using template makes the development makes the development faster, but we loos the freedom to develop the code in our very desired manner.
In short the customization is a big hurdle itself..!!

Although it adds another layer to the code (sometimes making it slower but not always, since you have caching) it helps separate the business logic from display logic. When your allowed to work with PHP in the view, you're tempted to do business processing in there as well.

But when you have something like Smarty, even though you can run PHP in there, you usually find yourself doing all the processing where it should be done (controllers, models) and just display the contents to the view.

The structure is enforced so that a new developer doesn't have to go through the view as well when he needs to change behavior.

what about your recommendation? Pros and cons?
Good explanations but don't forget that it is about either writing a PHP template or grab an engine! Sorry If I sound confusing !

Ok may be I have been too vague or misled you. If that is the case, I'm sorry. Let me try to clarify my point:

I can use ready made engine like smarty/PHPTal. Another alternative is writting my own using SSI. And here my question goes, which is the best and what are pros and cons of each?
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.