|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
include file according to a parameter
I need to include a file within a page but the address of the included file depends on a parameter So I wrote something like this: <!--#include virtual="/<%=FolderName%>/includes/includefile.asp"--> where FolderName is a variable containing a string. But this doesn't work. It seems that you can't build an include link with ASP. And I can't test the value of my variable since I will have many possible values and some new ones will be added regularly. Is there a way to do this? many thanks Luc I also tried this:
DIM filespec, fs, f, content filespec = Server.MapPath("/" & FolderName & "/logos.asp") set fs = CreateObject("Scripting.FileSystemObject") set f = fs.OpenTextFile(filespec) content = f.ReadAll() set f = nothing set fs = nothing Response.Write(content) But the ASP code in then displayed as plain text.
Show quote
"lucky" <lfe***@nordnet.fr> wrote in message No. Can you rearrange things so that instead of using an include you cannews:1153187584.444342.174890@m73g2000cwd.googlegroups.com... > Hi > > I need to include a file within a page but the address of the included > file depends on a parameter > > So I wrote something like this: > > > <!--#include virtual="/<%=FolderName%>/includes/includefile.asp"--> > where FolderName is a variable containing a string. > > But this doesn't work. It seems that you can't build an include link > with ASP. > And I can't test the value of my variable since I will have many > possible values and some new ones will be added regularly. > > Is there a way to do this? > use a Server.Execute? Show quote > many thanks > > Luc > > I need to include a file within a page but the address of the included This does not work, because the <!--#include directive is processed BEFORE > file depends on a parameter > > So I wrote something like this: > > > <!--#include virtual="/<%=FolderName%>/includes/includefile.asp"--> any code in <%%>. http://www.aspfaq.com/2042 |
|||||||||||||||||||||||