I've been looking for some guidelines on how to layout PHP code. I've found some good references, such as the following:
http://www.dagbladet.no/development/phpcodingstandard/
and this question on SO.
However, none of that quite gets to what I'm specifically wondering about, which is the integration of HTML and PHP. For example:
- is it OK to have a PHP file that starts out with HTML tags and only has PHP inserted where needed? Or should you just have one section of php that contains everything?
- If you have a chunk of PHP code in the middle of which is a set of echo's that just output a fixed bit of HTML, is it better to break out of php and just put the HTML directly?
- Should functions all be defined in dedicated php files, or is it ok to define a bunch of functions at the top of a file and call them later on in that same file?
There's probably other questions I'd like to ask, but really I'm looking for someone to point me at some kind of resource online that offers guidance on the general idea of how HTML and PHP should be combined together.
Thanks!
Ben