pauleth Posted April 9, 2008 Share Posted April 9, 2008 Hey folks, just looking for some suggestions and recommendations on the best way to mix PHP and HTML, while effectively keeping presentation and logic separate. Do you tend to use more PHP tags in HTML blocks, or use PHP with echo to generate HTML output. How about templates such as Smarty? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/100360-mixing-php-and-html/ Share on other sites More sharing options...
rhodesa Posted April 9, 2008 Share Posted April 9, 2008 I normally use ECHO for short blocks (just a couple lines) and close the PHP tag for anything larger then that. It's all personal preference. I have used Smarty in other 3rd party apps before and it's pretty slick. It's on my list to start using it on sites I build, as it will allow my clients to make small changes on their own without needing to know PHP. Link to comment https://forums.phpfreaks.com/topic/100360-mixing-php-and-html/#findComment-513174 Share on other sites More sharing options...
duclet Posted April 9, 2008 Share Posted April 9, 2008 Unless it is really simple, I always prefer to keep the HTML separate from the PHP. Using scripts such as Smarty is my preferred choice. It is slower on performance though but it is barely noticeable. Link to comment https://forums.phpfreaks.com/topic/100360-mixing-php-and-html/#findComment-513179 Share on other sites More sharing options...
pauleth Posted April 9, 2008 Author Share Posted April 9, 2008 Thanks for the responses! I have used Smarty a little and I definitely like it. I think it's probably the way to go using one of those templating systems, but I was hoping I could be lazy and avoid learning one... Link to comment https://forums.phpfreaks.com/topic/100360-mixing-php-and-html/#findComment-513205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.