![]() | Pepper Spray & Stun Gun Specials! KEEP THEM SAFE. | |
| CoverYourASP --> Object oriented ASP | ||
| 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 ClassesLooking 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. |
| ||||||||||||||||||||||||||||||||||||||||||||||||