Home

Server Side Page Includes

JavaScript  

Most servers have the ability to break pages into parts to give the author the ability to include common elements from a single file. Unfortunatly this process is only viewable on pages that are on the server. The code required is as follows:

<!--#include virtual="/dir/file.ext"-->
<!--#include file="subdir/file.ext"-->

Lets break it down in order to understand it more.

  1. <!-- -->
    Includes are placed in comment code hiding it from display when viewed outside of the server enviroment.
  2. #include
    Identifies the code to the server as an include event.
  3. virtual="/webclass/includes/nav_bar.htm"
    Identifies the page that will be included at the point on the page the include statment is placed.
Notes:
  • Do not leave any spaces between the equal ("=") sign and the file it specifies. Doing so will cause an error message to be displayed.
  • If you use a domain name you must use the virtual command. file only works with Powertrain URLs.
  • virtual
    gives a virtual path to a document on the server. A normal file or another parsed document may be accessed using this tag. Please note that the path of this file name should be the URL of the file, with the domain name removed, and the userid added. For instance, if the URL of a file is "http://www.your-domain.com/products/footer.txt" and your userid is "userid" then the path to use with this include directive would be: "/userid/products/footer.txt"

    Example: <!--#include virtual="/virtual_sample.txt"-->

    This is a sample text file. It was included in this file by the include virtual tag:
    <!--#include virtual="/webcom/virtual_sample.txt"-->.

    This paragraph includes a hotlink, and tags such as bold and emphasis.

    file
    gives a pathname relative to the current directory. ../ cannot be used in this pathname, nor can absolute paths be used. (If you need to refer to a file in a higher directory, you might consider using virtual described above.) As above, you can send other parsed documents.

    Example: <!--#include file="sample.txt"-->

    This is a sample text file. It was included in this file by the include file tag:
    <!--#include file="sample.txt"-->
    .

    This paragraph includes a hotlink, and tags such as bold and emphasis.

    The requirements of an included page:

    1. <HTML><BODY></BODY></HTML> Needs to be removed.

    2. Javascript that you want to include should be placed between <HEAD></HEAD> statments.

    Java Applets
    Available CGI
    META Tags
    Server Elements
      Page Includes
      Configuration
      Other Elements