Unzip everything to a folder on your desktop and copy the entire contents to a new web. There are no databases in this sample and nothing exotic in folder settings is required (other than scripts permissions for the ASPs of course!).
Go to the new web you've created and you should see the first page.
What it does
This code formats pages of a web site dynamically, basing the layout, colours and formatting contained in an HTML template file which some custom tags we've defined. Running a web site from a template in this way has a number of advantages we'll look at later.
How it does it
The buildpage.asp file needs to be included at the top of all content pages. It contains a function for looking up which template should be used (yes, you can get the page to choose one based on user selection, browser detection, entry page, etc.) and formatting two HTML chunks to be inserted at the top and bottom of each page, around the main page content.
These chunks are inserted by a response.write statement above and below the content of the normal site pages.
Uses for this kind of thing
For all sites, having the ability to change the appearance, layout, fonts, colours and pagewidth throughout the whole site by replacing one template file is a big bonus. The functionality also allows you to display the same pages using different templates: printer friendly versions, small screens, handheld versions, webTV versions, search engine pages, branding of content for different corporate clients, etc.
The template file must be static - ASP code within it will not run. In order to incorporate ASP code, you must run this in your buildpage.asp and add it into your page by replacing a custom xxxMYNEWTAGxxx you have added to you template(s).
Include files also cannot be used within your template. Again, you can include the code within these in your buildpage.asp if required.
This code is not for everyone but most developers will have some web sites where they wish they'd done it like this. It's another way of looking at things and it might just open up some possibilities you haven't thought of before.
You may use the code and functions within this
template sample application on any web site
for free providing the comments, copyright
messages and link to our site are retained.
Queries? Can't promise we can respond to
everything but try us!
Note From The Webmaster: We've stopped publishing live demos for most of our articles,
but I felt the need to make an exception for this one
so that you could really get a feel for how this works.
So, without any further delay, here it is. There's a link
at the bottom to come back to this page.
Getting the Code
You can download a zip file containing the scripts and this readme from