HomePHP Setting up the Foundation for an Extensible Website Engine with PHP 5
Setting up the Foundation for an Extensible Website Engine with PHP 5
Building a dynamic website with a database backend is something that nearly every PHP programmer will need to do, usually sooner rather than later. If you haven't done it yet (or even if you have), this two-part article series will show you how to develop a website engine that can generate pages on the fly from a simple database structure.
I'm sure that you still remember those old, sweet days, when building websites was a matter of coding a bunch of all-static HTML pages, including a few images on them, and creating the corresponding hyperlinks to use the goodies of the HTTP protocol. Yeah, those times were great, weren't they?
However, not all things must have that nostalgic feeling. This is particularly true when it comes to stressing the advantages of developing modern dynamic websites, which are mostly driven by a database backend. Definitely, creating websites that use different layers for storing content, handling visual presentation and structure, and performing all sorts of clever tasks via a server-side programming language (like PHP, among others), has become the usual scenario for many web developers.
Of course, since the subject is rather huge, there are many ways to build dynamic websites, aside from using a group of database tables for storing distilled content. You can use flat files for saving data, or in the best case, if your storage requirements aren't particularly demanding, server memory can be also a fairly good option. Nevertheless, as the web grows to unimaginable dimensions, databases are by far the most used mechanism for saving the contents of a website, and certainly that tendency has been continuing steadily for a considerable amount of time.
So, what's the point of this introduction, after all? Well, for experienced PHP developers, building database-driven websites can be considered a straightforward process, which probably will be performed with minor hassles, but for beginners or intermediate programmers, this experience surely may be quite troubling.
Therefore, in response to all the reasons that I mentioned above, over the course of this two-part series, I'll walk you through the development of a highly extensible and "pluggable" website engine with PHP 5, which will allow you generate web pages on the fly based on a predefined (but simple) database structure. By using a few comprehensive PHP classes, along with a single template file, you'll be able to create truly dynamic websites that maintain a consistent look across their pages.
Have you been missing the "dynamic" feature of your websites lately? Let's fix that up quickly with this expandable, PHP 5-based website engine!