Personally, I'd stick with the replace method you are currently using. If you really want to use a variable in your global file then you can use these methods:
<%
Sub parseASP(ASPCode)
dim y, x
dim lasterror
y = -1
x = Instr(1, ASPCode, "<%")
Do Until x = 0
if x <> 1 then Response.Write(Mid(ASPCode
y = InStr(x + 2, ASPCode, CHR(37) & ">")
if y = 0 then response.write("Error: Unterminated delimiter found."):Response.End
On Error Resume Next
Execute(Mid(ASPCode, x + 2, y - x - 2))
lasterror = err.number
if lasterror <> 0 then
Response.Write("<font color='red'>VBScript Runtime error:</font> " & lasterror & "<br>" & err.Description & "<br>Source: " & err.Source & "<br>")
end if
On Error Goto 0
x = Instr(x + 2, ASPCode, "<" & CHR(37))
Loop
Response.Write(Mid(ASPCode
End Sub
function getFileContents(strInclude
dim objFSO, objText, strPage
set objFSO = Server.CreateObject("Scrip
set objText = objFSO.OpenTextFile(strInc
getFileContents = objText.ReadAll()
objText.close
set objText = nothing
set objFSO = nothing
end function
Sub includeFile(strFilename)
dim sz
sz = getFileContents(strfilenam
parseASP(sz)
End Sub
%>
All you need to do then is pass the filename into:
includeFile(server.mappath
Main Topics
Browse All Topics





by: REA_ANDREWPosted on 2005-08-30 at 01:38:07ID: 14782515
Save this as the only include for your pages.
<%
dim topPath
dim bottomPath
topPath = "<!--#include virtual="/myproject/includ
bottomPath ="<!--#include virtual="/myproject/includ
%>
Then all you need to do is write this on each page
<%=response.write(topPath)
<%=response.write(bottomPa
i think