PHP guy here, don't know much about other languages, but seeing HTML mixed in with code is usually a bad code smell. Is this type of thing common in Python?
Generally you won't see PHP/JSP levels of code, but the more popular engines do allow quite a bit of logic, i.e. don't adhere to StringTemplate-level purity[1].
[1]: http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf
Most of these other frameworks/languages (barring CFM and old ASP) expect you to adhere to some sort of MVC.
Saying PHP smells by default is a little less than fair. :-)