Chapter 14. Constructing complex web pages
This chapter covers:
A complex web page is like a zoo. There may be all sorts of different creatures, all with different habits and requiring different care, cleaning, and feeding. Some of them are in cages (typically the stuff that surrounds the main content, such as banners, ads, menus, and various kinds of sidebars); some of them range freely on the main expanse of the page.
Keeping all these coordinated is one of the great challenges of web programming.
In addition, different species play together. A menu may need to communicate with a news list as well as with itself. Making this work properly is actually a challenge that goes beyond the scope of this chapter, since that challenge involves user interaction. Here, we will focus mostly on the display or View part of the job.
In this chapter, we’ll first introduce and discuss the Composite View pattern. Then we’ll show how to implement a simple, straightforward composite template using Smarty or PHPTAL. Finally, we’ll see how to solve a few more advanced challenges.
Modern web pages are not just complex; they tend to grow increasingly complex. But we have some tools to help us.