Different Strokes or IFrames and PHP Includes
Thursday, May 4th, 2006On a few of the more recent sites I am currently working on, I have come across both PHP includes and iframes as methods to simplify changes on a web site. Both systems do have their benefits, although I personally feel that one is generally better than the other. Here, I’m going to discuss the benefits of either option without regard for security (in which the iframe comes under attack)
PHP Includes
PHP includes a function that allows you to use multiple files on one page. The files are patched together at run-time and presented as just one file. This allows for some static piece in a series of pages to be written once, but used in all pages. The user has to download all of the content stored in the include each time he or she visits a new page, so there is a greater bandwidth consumption. As the include provides all of the details on one hyperlink, a user is able to jump to any given file on a web page. Google will be able to index all of the data on the site. Aside from bandwidth concerns, the biggest drawback to the PHP include method is that it requires the use of the PHP engine. At this point, most web hosts offer PHP support, negating this complaint, but if you don’t have PHP support, you are out of luck.
IFrames
IFrames act like an intermediary step away from the old framesets we web designers from back in the 90s remember. These pages are standard HTML pages with a tag linking the changing content to the main page. The primary benefit of this is that the page is standard HTML; there is no requirement for PHP support. Changing the content is just as easy now as it was with framesets in the past. The primary downside is that it is almost impossible to deep link to a page and that Google will probably not be able to index things after your main page that appear within the iframe.
IFrames were once an interesting way to assure a standard presentation of information that now has passed. AJAX based technologies have really superceded the functionality of the iframe and PHP includes have enabled a greater degree of usability. As is usually the case with web technologies, I have no doubt that iframes will be seen on a variety of (unfortunately) new web sites. But the technology itself is rapidly joining its father (the frameset) in relative obscurity.