I came into PHP from C-based & .NET programming, and one thing that struck me as particularly tough is the merging of the various syntaxes and languages inherent in web dev. As such, my first few scripts are getting very messy / unreadable, and so I wondered if there were any best practices or standard methods the more seasoned folks adhere to, when it comes to the melting pot of php, html, MySQL, js and whatever else you may use? (Specifically with the aim of keeping your code tidy & easy to follow.)
Like, I know header info has to go before any html is sent to the browser.
I have separate html scripts for the repeated page elements like a navigation bar, which I include as includes().
I have a separate DB connection script.
Do you have anything else useful, to standardize the logic of how scripts are constructed? I am improvising badly at the moment, and need to rein it in and clean my house, so to speak.