Results 1 to 8 of 8
Thread: Separating HTML from PHP
Oct 3, 2012, 17:58 #1
- Join Date
- May 2012
- 0 Post(s)
- 0 Thread(s)
Separating HTML from PHP
I am fairly new to both PHP and programming, but I am making good progress in learning the basics and some best practices (Sitepoint has helped a bit with that). A couple days ago a veteran here - Cups - suggested separating HTML from PHP. This was a different topic, but I was asking about how to get a form to display the way I wanted it to. One of the byproducts that Cups noticed was what I think some PHP veterans call "spaghetti code"
The code mixed PHP and HTML in such a way that it lead to some ugly looking echo statements that I think are hard to code and prone to mistakes. The suggestion was made to "separate HTML from PHP" which I think is great piece of advice, but I would like to ask the experts how they would go about this. I know the answer generally given is to use the MVC model and a good framework. My question is, short of that, what else can be done?
This is a wide open question and has been asked before, but I would love even more feedback.
Thanks ahead for any suggestion