|
|||
|
|
If you know what platform your host server runs on, you can take advantage of virtual includes to simplify site-wide navigation. For example, you can use
a series of files to create a single page, allowing you to make changes to one file only and have those changes appear across all pages of your site.
An example might be a header file that contains a banner script, or a menu file that contains a table of hyperlinks.
Here's how it works. On the NT Platform (Microsoft's IIS Web Server), you use .asp file extensions in place of .htm or .html files. For Linux users
(Apache Web Server), you can create .php files. The idea is to split up your pages into separate files, and them "include" those files into your pages.
Here's an example for the NT Platform.
<!--#include file="header.asp"-->
HTML code for the page file
<!--#include file="footer.asp"-->
For PHP under Linux, it will look like this:
<? include("header.php"); ?>
HTML code for the page file
<? include("footer.php"); ?>
If you're not running PHP in Linux, you can still use includes under the SSI standard (server side include) in this way:
SSI Server Side Includes
<!--#include virtual="header.shtml"-->
The header and footer are separate files that reside, in this example, in the root directory of your server. The files, header.asp and
footer.asp, represent blocks of code that eventually display as the top and bottom
portions of your page. So, if you have a page called index.asp, it would
call for the header first, then display the code of the index file itself, then call for the footer file. The browser displays a page based on the
three files involved. You can have as many includes for each page as you like. The benefit is obvious ... one change to the header file makes all
pages that contain it change as well. It's a terrific way to save time and the hassle of coding all pages separately. Give it a try and see how Virtual
Includes can simplify your own website.
Note: you should contact your Web Host to make sure your Web Server can handle includes. By Default, IIS and Apache allow this, but your system
administrator will be able to confirm whether this form of scripting is available to you.