-
1
- #1
If you've ever wanted to include a file into your page but the filename is dependant or can change subject to various factors use this code. I use for my affiliate program so I can add in a suitable header with their logos etc.
filename=varfile & ".inc"
Call DisplayFile(filename)
SUB DisplayFile(FileToRead)
filename=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject"
Set thisfile = fs.OpenTextFile(filename, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
end sub
filename=varfile & ".inc"
Call DisplayFile(filename)
SUB DisplayFile(FileToRead)
filename=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject"
Set thisfile = fs.OpenTextFile(filename, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
end sub