Problem with including a header

Discussion in 'ASP General' started by Jim Mesara, Aug 28, 2003.

  1. Jim Mesara

    Jim Mesara Guest

    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
    Jim Mesara, Aug 28, 2003
    #1
    1. Advertising

  2. Jim Mesara

    Ray at Guest

    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

    "Jim Mesara" <> wrote in message
    news:billlu$afp0p$-berlin.de...
    > 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
    >
    >
    Ray at, Aug 28, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eternally
    Replies:
    7
    Views:
    394
  2. shruti

    problem including perl header files

    shruti, May 15, 2006, in forum: C Programming
    Replies:
    2
    Views:
    450
    Keith Thompson
    May 15, 2006
  3. shruti

    problem including header files in TC

    shruti, May 15, 2006, in forum: C Programming
    Replies:
    1
    Views:
    417
    Flash Gordon
    May 15, 2006
  4. mlt
    Replies:
    2
    Views:
    804
    Jean-Marc Bourguet
    Jan 31, 2009
  5. Replies:
    2
    Views:
    199
    A. Sinan Unur
    May 15, 2006
Loading...

Share This Page