how to get relative links to work in a include file.

Discussion in 'HTML' started by diablo, Jun 25, 2005.

  1. diablo

    diablo Guest

    hi

    all my pages have a menu of links on the left side.

    i want to use a include file <!--#include file="" --> to hold the menu but i
    am having a problem

    here is my folder structure

    foldA
    ---foldb
    ------fb.asp

    inc
    ---links.asp

    page1.asp


    now in page1.asp i include the links.asp file.

    in links.asp there is a link like so

    <a href="../foldA/foldAA/fb.asp">foldB</a>

    now when i load page1.asp and click the link i get a file not found because
    it is looking for the file at a place relative to page1.asp not to
    links.asp.

    is there a way i can do this? or do i need to put in the whole url for each
    link in my links page?

    thanks

    D
     
    diablo, Jun 25, 2005
    #1
    1. Advertising

  2. diablo

    diablo Guest

    ok i have kind of resolved this - or rather got a work around for it.

    if i create a folder on my live site called TEST ( or the same name of my
    virtiual folder on my local pc) then i can use

    <!-- #include virtual="test/inc/links.asp" -->

    in any place and it will always get the file.

    and i can use

    <a href="/test/foldA/foldAA.fb.asp">

    and it will link from any place.

    just a bummer that i have to have my site within a folder


    "diablo" <> wrote in message
    news:jBgve.4167$...
    > hi
    >
    > all my pages have a menu of links on the left side.
    >
    > i want to use a include file <!--#include file="" --> to hold the menu but

    i
    > am having a problem
    >
    > here is my folder structure
    >
    > foldA
    > ---foldb
    > ------fb.asp
    >
    > inc
    > ---links.asp
    >
    > page1.asp
    >
    >
    > now in page1.asp i include the links.asp file.
    >
    > in links.asp there is a link like so
    >
    > <a href="../foldA/foldAA/fb.asp">foldB</a>
    >
    > now when i load page1.asp and click the link i get a file not found

    because
    > it is looking for the file at a place relative to page1.asp not to
    > links.asp.
    >
    > is there a way i can do this? or do i need to put in the whole url for

    each
    > link in my links page?
    >
    > thanks
    >
    > D
    >
    >
    >
     
    diablo, Jun 25, 2005
    #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. Victor Bazarov

    #include "file" -vs- #include <file>

    Victor Bazarov, Mar 5, 2005, in forum: C++
    Replies:
    4
    Views:
    545
    Exits Funnel
    Mar 6, 2005
  2. PTM
    Replies:
    1
    Views:
    338
    Andy Dingley
    Nov 12, 2007
  3. Andreas Bogenberger
    Replies:
    3
    Views:
    948
    Andreas Bogenberger
    Feb 22, 2008
  4. LB
    Replies:
    1
    Views:
    858
  5. Garrett Smith
    Replies:
    14
    Views:
    317
    David Mark
    May 26, 2009
Loading...

Share This Page