3raser Posted March 26, 2011 Share Posted March 26, 2011 I've asked people before on what their opinions are for using a template type of system with PHP, or using the actual PHP code with HTML in the same file. I know the template system is more organized, but takes longer for the code to run. So, what should I start using if I were to work on some real projects? Quote Link to comment https://forums.phpfreaks.com/topic/231759-php-html-or-separated/ Share on other sites More sharing options...
trq Posted March 26, 2011 Share Posted March 26, 2011 Template systems are overkill IMO, there are better ways of separating code (logic) from presentation (markup) without the extra overhead. A well designed application should allow most (if not all) of your logic to be separated from markup with only minimal amounts of PHP ending up amongst your HTML. I've posted an example of this on the boards here before, I'm not sure this was the exact one I was thinking of but it's about all my search could find. See http://www.phpfreaks.com/forums/index.php?topic=320371.msg1510211#msg1510211 Quote Link to comment https://forums.phpfreaks.com/topic/231759-php-html-or-separated/#findComment-1192450 Share on other sites More sharing options...
SamT_ Posted April 2, 2011 Share Posted April 2, 2011 Template systems can be very useful (especially when creating some sort of style engine). They do an effective job at keeping your PHP logic away from your display, which is good for medium to larger sized projects that require that sort of abstraction. Although there is a learning curve, it is often worth it for the benefits you get. I personally use Twig for my projects, and I can speak for it's performance. Quote Link to comment https://forums.phpfreaks.com/topic/231759-php-html-or-separated/#findComment-1195944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.