Use PHP to Simplify Headers and Footer on Your Web Page
By Winfield Ross, published May 07, 2008
Published Content: 34 Total Views: 3,150 Favorited By: 0 CPs
There is a better way! Use PHP.
Don't stop reading if you are unfamiliar with PHP. Although PHP can get complicated, using PHP to simplify changes to headers or footers across all pages of your web site is quite easy. If you have a basic understanding of HTML then this use of PHP will be simple.
First, what is PHP? PHP is a scripting language developed to aid in web development and which can be embedded in HTML.
PHP was created in 1995 by Rasmus Lerdorf who developed a basic script to track how many people were viewing his online resume. He continued to add to the abilities of the script, the purpose of which was to help people maintain Personal Home Pages, thus the abbreviation PHP. As PHP has evolved, so has the description behind the name, which is now HyperText Preprocessor.
PHP is a server side script embedded in the HTML of the web page. While HTML is interpreted by the local browser, the PHP script is interpreted by the server and executed. The PHP code can do many tasks. The output is combined with the HTML with the result sent to the user's browser. If the user reviews the source code, they see the resultant HTML rather that the PHP script. They will not know that PHP was even used on the web site.
Luckily, you don't need to be a programmer or understand PHP to use this basic script on your web site. The only requirement is that your server supports PHP.
The picture to the left is an example of a PHP script. This can be the first portion of your web page prior to the HTML for the body of the web page. What this script does is tell the server to read and interpret the file "header3.php" before the rest of the page is interpreted by the local browser. In this case the file header3.php is a file with the HTML coding that you want for your header. The file header3.php is not different than any other HTML coding, but the extention "php" allows it to be treated differently.
Use PHP to Simplify Headers and Footer on Your Web Page
You may also like...
- Introduction to Web Design and Development 1
- Five Most Effective Ways to Get Your Web Site Content to Explode!
- PHP and XML: What to Do and How to Do It
- Weaving a Web with a Network
- Designing Web Games with Javascript, PHP, and AJAX
- How to Produce Good and Resource-friendly PHP Code
- Is iCab the Right OS X Web Browser for You?
Takeaways
- Using PHP to simplify changes to headers or footers across all pages of your web site is quite easy.
Comments
Type in Your Comments Below - (1000 characters left)
Most Commented On


