Creating a Template

Using the template

Now to use your template, all you have to do is include the template file, then call Header and Footer at the appropriate locations. Here's the code for a sample page that imports the template.

<!--#include virtual="/include/template.asp"-->
<% Header "Template Test" %>
This is a test of my new template! Isn't it nifty?
<% Footer %>

The resulting page looks like this:

Template Test
Nav 1
Nav 2
Nav 3
This is a test of my new template! Isn't it nifty?

That's all there is to it. The real advantage to using a template is maintainability. If you need to change the navigation on your site, you don't have to go and change every single page anymore, nor do you have to resort to clunky frames. You can simply modify your template.asp file, and every page on your site changes.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup