Chapter 13. Using templates to manage web presentation

 

This chapter covers:

Web presentation, in its simplest form, is a plain HTML document. PHP helps us insert dynamic content into the HTML document simply. But as the program code grows more complex, the combination poses new challenges. Increasingly, program code and HTML markup appear as Siamese twins: They’re together all the time, but they might be better off spending some time apart. They might prefer to meet and work together when it’s actually needed instead of being inseparably attached to each other. Adding to this is the fact that even though they’re joined together, they have very different personalities. When we try to apply modern programming principles, we find that only the PHP code responds properly to it. HTML markup needs to be cared for in completely different ways. Doing this is much easier if we try to separate them.

13.1. Separating presentation and domain logic

13.2. Which template engine?

13.3. Transformation: XSLT

13.4. Keeping logic out of templates

13.5. Templates and security

13.6. Summary