Problem with including a header

J

Jim Mesara

I have the following file structure:

/
header.asp
test.asp
/subDir
testpage.asp
/images

I would like to have header.asp to be usable from all directories.
Header.asp will have images and URLs. When I try to #include the file in
test.asp, it works fine. However, if I #include it in testpage.asp, the
images in header do not work - testpage.asp thinks the images are in subDir,
when they are in the images directory. I have tried a variety of
combinations of MapPath, Server.Execute, but I have not gotten the image to
appear correctly. What is the correct syntax for what I am trying to
accomplish?

Thank you for you time,
Jim
 
R

Ray at

Do virtual includes and image paths from the root in header.asp. Example:


Do NOT do:

<!-- #include file="../header.asp" -->
<img src="images/something.gif"> (in header.asp)

DO:

<!-- #include virtual="/header.asp" -->
<img src="/images/something.gif"> (in header.asp)

That way it will not matter if you're in a different directory level, since
it will all be relative from the root of your site, the include as well as
the image paths in the include file.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top