Building A Simple PHP Application
Sep 8th, 2007 by jon
Anyone who is thinking about getting into managing websites or even just programming will most likely need to build (or manage the building) of a web application at some point. While trying to teach an online course in building web applications would be an exhausting procedure it would be of great importance to a lot of people to learn the differences between different web applications on the internet. In this series of posts we are going to be covering different implementations of PHP and what their strengths and weakness are.
The first step you need to take is determining what kind of PHP implementation you need. If you are running a small content-based site then you may not need to go out and install Joomla, but on the other hand if you are trying to start the next Wikipedia then writing a flat site with a few PHP scripts may not be a good idea either. In this series of posts I will place most PHP implementation in one of three categories.
The first category is the “flat site with PHP scripts impeded”. This is the simplest and most common form of PHP implementation on the web. This sites basically consists of creating a static HTML page and embedding PHP scripts within it. This can be useful for many smaller or more simple sites because it allows you to add some simple dynamic content without having slowdown caused as a result of processing time or database calls. In many cases using CSV or XML files will do for storing data provided that they don’t contain passwords or other sensitive data.
Example
Advantages
- Fast
- Lightweight
- Simple
- Don’t need a database
- CSV or XML files will work fine for content
Disadvantages
- Limited dynamic content
- Fast growing pages may become very complex very quickly
Okay, so let’s get started building a simple blog. As you can see below a simple PHP script has been written the takes data from a CVS file and prints it to the screen. it’s pretty simple, but it gets the job done overall. You can even continue to build on this an add a nice style sheet to really spruce your blog up. Next time we’ll build a simple page that allows an author to post to their blog without having to edit the CVS file directly.
And here is the CSV file I used.
Hello,09-04-2007,This is my first post!
Testing,09-03-2007,I am going to test my blog now!
In the next post I will be discussing how to improve this simple script (there are some glaring problems with it if you have done this before) and use it to build a simple Content Management System. As we progress on this series of posts we will be building a basic CMS / Blog Management tool.
If you like this post, then consider buying me a beer!
Whoohoo!
I remember the days of such simple things.
Yeah, it was really nice. You should see the codebase I am developing at work. The Bryan and I are pretty sure we have hit the limit of how large a PHP application can be before it starts bursting at the seams.
Hi, i followed the breadcrumbs here from your visit to Geeknews. I’m subscribing to your feed to continue following your PHP training.
Thanks!
Hey, Thanks. I’ve been meaning to get the second part up but this week at work has been very busy. So is the life of a software engineer, I guess. I am hoping to have part 2 (The Simple CMS) posted this weekend.