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 Look
Browser Support
Refresh content window without refreshing navigation
Multiple 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:
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.
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 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 can’t make conditional Include statements.