Frames vs. Include Files
Frames vs. Include Files by Gary Williams

One of the first issues we were faced with in the planning stages of ASP 101 was whether or not to use frames. Frames have many pros and cons, and it was apparent pretty early on that the cons outweighed the pros for the design goals of this site.

Pros:
Cons:
Uniformed LookBrowser Support
Refresh content window without refreshing navigationMultiple Frames become difficult to manage

We basically wanted the benefits of frames without the headaches they can cause. Our solution was to format each page of the site in a table. Tables are easier to manage and are more widely supported by older browsers.

Below is a simplified example of how to add a left hand navigation bar to your site without using frames. The first step is to envision the entire page as one large table. The table is going to have one row and two cells.

<TABLE Border="0">
    <TR>
         <TD Width="140">Navigation bar goes in this cell</TD>
         <TD Width="500">Contents go in this cell</TD>
    </TR>
</TABLE>

This is what the above will output:
Table Layout

This table structure must be included in every page on your site. In order to maintain consistency and eliminate redundant code Include Files will be implemented. The table above is going to be split into two include files. (page_begin.inc and page_end.inc)

Page_begin.inc:

<%@ language='vbscript' %>
<HTML>
<HEAD>
   <META name="description" content="Your meta data goes here!">
   <TITLE>Your Title goes here</TITLE>
</HEAD>
<!-- BEGIN BODY TABLE -->
<TABLE Border="0">
    <TR>
<!-- Begin NAVIGATION BAR -->
         <TD Width="140">Navigation bar goes in this cell</TD>
<!-- END NAVIGATION BAR -->
         <TD Width="500">

<!-- BEGIN CONTENT -->

 

page_end.inc

<!-- END CONTENT -->
        </TD>
    </TR>
</TABLE>
<!-- END BODY TABLE -->
</BODY>
</HTML>

Next we are going to put these two files in their own directory so they will not be confused with the sites content. This directory is going to be named "template".

Each page of content must call the two include files.

<!-- #INCLUDE FILE="../template/page_begin.inc" -->

Your content goes here!!!!!!!!!!

<!-- #INCLUDE FILE="../template/page_end.inc" -->

Now when you want to add a button to your navigation bar the only file you will have to alter is page_begin.inc.

A few points of caution:

A file must have the extension .ASP to call an include file that runs server side script. This means that every page of your site that incorporates the structure defined by your include files must be an ASP file. Using relative paths to call include files limits your content files to one directory deep of the root of the web. This issue is easily resolved by calling virtual includes. However, make sure all of your links within a virtual include file are absolute.

<!-- #INCLUDE VIRTUAL="/template/page_begin.inc" -->

Your content goes here!!!!!!!!!!

<!-- #INCLUDE VIRTUAL="/template/page_end.inc" -->

 

Include files called from within an ASP file are inserted into the output before any of the script in the file is run. As of ASP 2.0, you cant make conditional Include statements.

Close    To Top
  • Prev Article-Web Design:
  • Next Article-Web Design:
  • Now: Tutorial for Web and Software Design > Web Design > ASP > Web Design Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction