ASP 101 - Active Server Pages 101 - Web01
The Place ASP Developers Go!

Please visit our partners


Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates














ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
The Top 10 ASP Links @ Microsoft.com
What is Adovbs.inc and Why Do I Need It?
An Overview of ASP.NET

QUICK TIP:
Watch The Case of Your URLs for Your Cookies' Sake
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


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 canít make conditional Include statements.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers