I personally agree with Cedric, mixing not languages, but responsibilities in a file (layout + view handling) is troublesome. We already tried it (JSP, ASP) and they are deprecated because they are horrible. Facebook is specialist in providing old patterns as bright solutions.