ASP skinning engine

Classic ASP skinning engine

I've developed hundreds of ASP web sites including my own content management system U-Update. I've used many types of skinning / templating systems including: Dreamweaver templates, include files, etc. but was never happy with any of these solutions.

I often found that at some point in a projects life cycle the specifications would change, with this class based system I could extend the functionality of the theme without breaking backward compatibility with existing pages. If you've wanted to add an extra parameter to a function in classic ASP (you can not override) you'll know what I'm talking about.

So I decided to write a system that would work with the way I code. The result was a ASP theme class that is simple, manageable (even on larger sites) yet flexible.

This system simplifies theme maintenance in to 1 file but unlike .inc files is extendable by taking advantage of class properties. Let me explain what I mean with some example code:

First include the ASP theme class:

<!--#include file="../incs/theme/theme.class.asp" -->

Then setup the skinning engine:

<%
Dim
page : Set page = new Theme ' Create a theme object from the ASP theme class
page.Title = "(¯`·._(¯`·.Classic ASP skinning engine.·´¯)_.·´¯)" ' Set the page title
page.Intro = "ASP skinning engine" 'Set the pages intro text
page.AddCSS = "css/theme.css" ' Set the CSS file, repeat to add additional CSS files
page.Sitemap("Source Code") = "incs/theme/web.sitemap" ' Set the active page and sitemap
%>

Now write the body of the page:

<% Response.Write(page.Head) %>
<!-- any page specific additions to the head -->
<% Response.Write(page.Body) %>
<h1>Main Body</h1>
Your page content here
<%
Response.Write(page.Foot)
Set page = Nothing
%>

As you can see from the code above:

Perhaps the easiest way is to copy an existing page and change the values to suite your needs.

What I like about this ASP skinning engine is that it uses an ASP XML navigation system, when setting up the skinning engine note the line:

page.Sitemap("Projects") = "incs/theme/web.sitemap" ' Set the active page and sitemap

This allows you to manage the navigation of all the pages from 1 file. For a stand alone version see the XML navigation page.