473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

include file according to a parameter

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?

many thanks

Luc

Jul 18 '06 #1
3 1882
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.

Jul 18 '06 #2

"lucky" <lf****@nordnet.frwrote in message
news:11**********************@m73g2000cwd.googlegr oups.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?
No. Can you rearrange things so that instead of using an include you can
use a Server.Execute?
many thanks

Luc

Jul 18 '06 #3
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"-->
This does not work, because the <!--#include directive is processed BEFORE
any code in <%%>.

http://www.aspfaq.com/2042
Jul 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: middletree | last post by:
I have a page which, according to the boss's instructions, needs to show one of two things, based on which radio button was chosen on the previous page. Because these 'things' are actually some...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
12
by: Francois Grieu | last post by:
Can #include safely use a preprocessing token, as in #define HEADERFILE "stdio.h" #include HEADERFILE int main(void) {return printf("Hello, world\n")*0;} TIA, François Grieu
5
by: Angel | last post by:
Is there some way to add a C-header file into a C# project? The problem is that this .h file contains several complex structures (over 20) that are used by some unmanaged code. These functions...
14
by: Gary Nelson | last post by:
Anyone have any idea why this code does not work? FileOpen(1, "c:\JUNK\MYTEST.TXT", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Shared) Dim X As Integer For X = 1 To 26 FilePut(1, Chr(X +...
2
by: David Arden Stevensonn | last post by:
On 'sub1.othercompany.com' there is a simple php file with an include that calls a script on my company's server 'sub2.mycompany.com' The script on my company's server seems to work fine when I...
9
by: Daz | last post by:
Hi everyone. I am a little stumped at why when I try to include a file in same directory as the script being processed, it looks in the same directory as the script that included it to begin...
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
10
by: jaime | last post by:
Hi all. According to the fgets wikipedia page, its prototype is: char* fgets(char *string, int length, FILE * stream) Given that fgets never assigns to the first parameter (the char...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.