O'Reilly logo

PHP Advanced for the World Wide Web: Visual QuickPro Guide by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

PHP and OOP Templates

While using objects can greatly simplify your code and expedite development of a site, it has a number of limitations, as mentioned in Chapter 2, Object-Oriented Programming. One of the big problems you may encounter is how best to interlace PHP and HTML while promoting separation.

For example, I want every page of the site to use a dynamically created footer such as Last modified Saturday, May 25, 2001. However, the template for the page itself contains only HTML, and if I were to place PHP within it to generate the footer, it would not be executed because the object process merely reads in the HTML template, replaces certain values, and prints it all out to the browser. No PHP execution takes place.

In the index.php object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required