The Object-Oriented Website

One of the most-requested additions to this book was a discussion on how to use OOP to render web objects - namely a messageboard, a poll, or even the website's HTML itself. After all, for a book called "Hacking with PHP", there's an awful lot in here about dogs!

The first thing we're going to look at is make your site object-oriented in a very simple way - we'll make a site class and a page class. Then we'll move onto looking at how we could subclass the page class so that we can have different types of page rendering differently. If you're looking for information on how to make an object-oriented messageboard, this is under the Practical PHP chapter, at the end of the section on messageboards.


Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: A basic OOP site >>

Previous chapter: Deferencing object return values

Jump to:


Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.