[thelist] dynamic includes in ASP?

Wade Armstrong wade_lists at runstrong.com
Tue Dec 31 01:04:01 CST 2002


on 12/30/02 9:58 PM, Jeremy Weiss at jweiss03 at comcast.net wrote:

> Well, I couldn't figure out a why to do it using includes, but I did find a
> solution on the 4guys site.  I've added it below for those who are
> interested.
> Set FSO = Server.CreateObject("Scripting.FileSystemObject")

> :Okay, I've been popping cold pills and I've got a drug induced idea.  I'm
> :working on a site that's going to have a decent number of pages in it.  And
> :I'm thinking, instead of designing all the pages and have to do
> :massive find
> :and replace searches every time I need to change the layout, why not have a
> :page called main.asp and all the links point to something like
> :
> :main.asp?pageurl="filenamehere.asp"
> :
> :and have the VBScript pull the value for pageurl and use it in the include
> :further down the page

Take it a step further, and instead of including a separate template for
each page, keep in mind that many of your templates have similar elements -
for instance, a nav bar or breadcrumb trail. Rather than creating several
templates that all have these elements, create a series of functions that
will write out these elements. These functions can be customized to take
input from the querystring or, even better, from the file name or directory,
to display the correct content; if you want to change how your banner looks,
it's a simple matter of changing a function.

So your page will look something like:

<!--#include virtual="writenav.asp"-->
<!--#include virtual="writebreadcrumbs.asp"-->

<%
Call writenav

Call writebreadcrumbs

'etc....

%>





More information about the thelist mailing list