ASP/.NET Web Hosting
* 3 Months FREE *
CLICK HERE!
 CoverYourASP --> Object oriented ASP

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
119 active users
10166 visitors today
10998 pages today
how is this done?
ASP.NET Showcase
ASP.NET Graph and Chart Component with FREE developer version

ASP.NET Shopping Cart and E-commerce Control with FREE trial download

ASP.NET Web Hosting with free month and setup

$15 Domain Name Registration from .DNR.
As seen on these sites
Special thanks go to the sites that support me by publishing my articles.
See more

CoverYourASP
Copyright © 1999-2008 James Shaw.
All rights reserved.

ASP.NET Blog
ASPRSS
ShawThing

Now open source with SourceForge!

Some have called my page layout "object-oriented" with the Init, Header, Content and Footer functions, but it isn't really so.

In hindsight (which is always 20/20 as we all know) the problem with my design is that it doesn't keep some opening and closing tags together in the same file.

For example, Init () contains the <html>, but Footer () contains the </html>. <body> and </body> are similarly separated.

This isn't good at all, and is contrary to one of my strongest design goals - keeping related code together in one place - a philosophy which makes it easier to improve and maintain your code.

A recent discussion about this with a colleague of mine, Ken Reed, led to an experiment, and the code behind this article. This is a true OO concept that makes my design look as dated as pages that still use render blocks!

The Page Classes

Looking at the basic elements of an html page, I created the following classes: Page, Head, Body, Header and Footer.

Page is the top-level class, and contains one Head and one Body, each related to their html tags, <head> and <body>.

Body in turn contains a Header and a Footer, which although not related to any specific html tag pair are common page elements nonetheless.

These classes are defined in the SSI (Server Side Include) file called utils/PageClasses.asp.

Part 2: The Page Classes...

Featured sponsor
My favorite resources

Selling products online - read how James does it now


CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!