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/phpcod
Combining programming code and output data (including HTML) is IMHO a very bad idea. Most of the PHP gurus I know use a template engine such as Smarty to help keep the two things separate.