Ten Ways to Use PHP on your Website Copyright © 2009 Chuck Matthews
PHP is an open source programming language
PHP is a programming language that allows your website to go beyond a basic HTML document, and create an interactive experience. Open source means that the source code is available to someone with proper access to the site, so that they can easily make changes. When the Internet was first getting started, most of the pages on websites were basic HTML documents. Meaning that when you visited a page (about.html, for example), you downloaded all of the content of the page into your browser.
How Do I Know if I have a PHP Site?
If you are visiting a site, and you see that the page name ends with .html, this means that the page is most likely a plain old HTML page. If the page name ends in .php, then you the site is a php based site. Other dynamic programming languages include .jsp (Java Server Pages) or .asp (.NET or Active Server Pages). Occasionally you’ll see sites that end in .html that have dynamic code embedded in them, but this requires some tricks to accomplish on the server.
We have several sites that use static HTML pages and have great results. There are some pages that have dynamic content, but most of the pages are built in straight HTML. It’s great for search engine optimization, as some of those pages have been active for years. However, as the number of pages grow, it becomes increasingly difficult to update menu or navigation items, because it means you have to open each page, one at a time, and modify the contents.
Advantages of using PHP
PHP works a little differently. Instead of downloading the entire page (with the navigation, content and everything in one file), php allows you to embed programming code that isn’t displayed to the end user. This programming code allows you to tell the page, “Insert the top navigation here.” Or, “put the content for the page over there.”
PHP allows you to personalize a page, for example, or automatically detect that a user is coming into the site from a mobile device and display a different version of the site that is optimized for their Blackberry or iPhone. PHP keeps most of the code for the site “behind the scenes” so that the page that is displayed to the end user loads quickly and doesn’t require the browser to do processing work — the work is handled instead by the server.
PHP Is Ideal For Working With Databases
One of the biggest advantages of a programming language like PHP is that it allows you to easily interact with a database. If you’re unfamiliar with databases, think of a database as a souped-up form of an Excel spreadsheet. You have columns (i.e. page name, content, title) and rows. Rows typically would hold information that is organized by column headings.
PHP makes it easy to read information from a database, and then display information onto a web page. So, if you’ve ever used a site where you type in your zip code to find a store location near you, the system likely is taking your zip code, performing a database query (i.e. find all stores within 10 miles of the 80303 zip code) and display the results so that you can find your way. In order to do this, we have a geolocation database that allows us to tell the approximate distance between two zip codes.
You could do the same thing by building out a series of web pages that has each location. And while this is fine for three or four locations, as the number of locations increases, PHP allows you to automate the process.
Keep Content Organized
One of the ways we’ve been able to streamline the process of building websites is that we’ve standardized our process using our PageDirector content management system. There are many, many ways to build websites. Each designer seems to have a slightly different way of putting a site together. We are frequently asked to work on sites that other people have created, and in order to make simple changes to the content or navigation, we often have to dig around in the code to find where things are located. This takes time and isn’t very efficient. The PageDirector system, however, keeps all of the content for the site neatly organized in a database table. So that anyone can easily find the content and make changes quickly and easily. One of our clients said to me in an email to me yesterday, “It’s really efficient and a simple tool to use PageDirector. It makes my life easier being able to update the website fast.”
How Does It Work?
When someone clicks on a link to go to a page, the system pulls the right content from the database, grabs the menu items from another location, and on-the-fly creates the page for a person.
Summary
PHP is a server-based programming language that allows you to create an interactive experience for your site visitors, and keep content and other information organized within a database.
About the Author: PHP is a programming language that allows your website to go beyond a basic HTML document, and create an interactive experience. PHP allows you to create an interactive experience for your site visitors, and keep content and other information organized within a database. This article explores some of interactive applications that can be developed using PHP. https://www.customerparadigm.com/index/21/Articles_Media.php