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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Common Include File 2

Status
Not open for further replies.

Faheem786

Programmer
Sep 5, 2001
30
HK
Hi there,

I have a website in which all the files are kept within a root folder called "MyWebSite".
The root folder has all the .asp files among which I use one include file called header.asp which is common for all the files.

The problem is I have also some internal folders and files(ex: MyWebSite ->InternalFolder ->"InternalFile.asp") where also I would like to include the header file to avoid re-writing the codes.

I included the file like <!--#include file=../header.asp -->
The file is actaully got included but with the broken images.I understand the reason why(it's because the path for the images are not correct)

I want to know some beautiful way so that I could use only one header file in the root folder and make it common for all the files in the root as well as sub folders without the broken image. I beleive there is some way you experts could help me.

Thanks in advance
Faheemi
Hong Kong
 
use <!--#include virtual=&quot;/includes/yourinclude.asp&quot;-->

virtual begins looking from the root directory of your web, so in my example, includes would be a root folder of
Then, all the images and what not would be relative to that location.

A great way to ensure that the images do not get 'broken' is to use the virtual path...

<img src=&quot;/images/myimg.gif&quot;>

again - this will start at the root directory, so images would have to be a root folder on
so something like:
>
images >
myimg.gif
includes >
yourinclude.asp

I put both down because I don't know if your include file references other files in other folders...

I don't like using the http:// method because I'm not sure if it's making roundtrips back to the server, just to load up a local image. hth
leo

------------
Leo Mendoza
lmendoza@students.depaul.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top