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
Use a template engine when you can. If you haven't learned one, or don't want the overhead (which is minimal), use practices that cause you to have quick-and-dirty templating:
Many PHP tutorials intermix logic and display code. It took me years to break the bad habits that encouraged in me. In my experience you can't separate things too much in PHP, and entropy will pull you towards intermixed code if you don't fight it.