[thelist] dynamic includes in ASP?

Jeremy Weiss jweiss03 at comcast.net
Tue Dec 31 00:02:00 CST 2002


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.


Dim FSO, inFile
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set inFile = FSO.OpenTextFile( Server.MapPath(
"nameOfFileToInclude.html" ) )
Response.Write inFile.ReadAll
inFile.Close
Set inFile = nothing


Just replace "nameOfFileToInclude.html" with the variable of choice and
you're in business.  Of course I'd still like to get it working using just
regular includes if anyone has any ideas.  ;)

Later,
Jeremy
PreferredLendingNetwork.com

:-----Original Message-----
:From: thelist-admin at lists.evolt.org
:[mailto:thelist-admin at lists.evolt.org]On Behalf Of Jeremy Weiss
:Sent: Monday, December 30, 2002 11:23 PM
:To: Evolt
:Subject: [thelist] dynamic includes in ASP?
:
:
: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 like...
:
:<!--#include file="<%=pageurl%>"-->
:
:My thought was that each of these files could be just the content of the
:page and I'd be able to change the look of the entire site by modify just
:main.asp.
:
:Great idea I thought... unfortunately it's not working.  I keep getting an
:error that says
:
:The include file '<%=pageurl%>' was not found.
:
:Anyone know of a way around this?  Just wondering.... if the answer is
:obvious blame it on the medication.
:





More information about the thelist mailing list