Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding include file dynamically 1

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
G'day all,

I want to include a file in the body of a page.

Normally it would look like <!-- #include file=&quot;filename.asp&quot; -->

However, I want to include a file based on a filename in a record I look up.

The obvious way to do this is <!-- #include file=&quot;<%= rsRecord(&quot;filename&quot;)%>&quot; --> however this does not work because it appears the include is done before the ASP script is run.

Does anyone have a solution for this? Steve Davis
hey.you@hahaha.com.au
 
Can't include a file dynamically in a include tag but this does what you want
<%
whichfile=your_filename & &quot;.asp&quot;
Call ReadDisplayFile(whichfile)
SUB ReadDisplayFile(FileToRead)
whichfile=server.mappath(FileToRead)
Set fs = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
end sub
%> Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top