Simple PHP Solutions: Part 1: Using Switch, If, Echo, and Variables to Create a Single File Site
Tuesday, May 12th, 2009 @ 10:30 am
At a loss for what to write about in this blog, I asked my web-savvy friends what they’d like to learn from me. I received a number of useful suggestions, but today I’m going to address Nichole’s request:
“I don’t know PHP … and I think an intro post would be nice and helpful. Especially if you can include ways on how beginners can use it in their sites.
”
So this entry is the beginning of a new series: Simple PHP Solutions. In this series, I’m going to attempt to explain some very basic PHP techniques to enhance your web sites, using practical examples. I hope that I can do this in simple terms — otherwise, why not leave this to the countless other PHP tutorials and books out there? In other words, I’d like to differentiate this series by (a) using examples that I think you could make use of, and (b) explaining these examples in the simplest terms possible, so that people without previous coding experience can figure out what I’m talking about.
For today’s Simple PHP Solutions, I’m going to use the PHP tags Switch, If, Echo, and variables to create web site from one PHP/HTML file. Of course, you can (and hopefully will) spice up your site with external CSS files, maybe some images and JavaScript, etc, but the point here is that the content of the site will be entirely contained within one file.