#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    4
    Rep Power
    0

    Question Virtual Directories, includes, & getting correct paths???


    Hi,

    I'm trying to have 1 folder for include files that can be called from other files on root, in subfolders below root, and in subfolders under other sub-level folders.

    What approach should I take? Here's what I've tried:

    First, Tried regular #include file=inc/filename, and that works, but then I need to make different versions of the same code for each folder level that will call the include files. (ie, 1 level below root gets "#include file=../inc/filename for the include and links & images have "../" before their path, too. It works but the multiple copies of the code is an issue for updating.

    Second, tried virtual #include virtual=include/filename, and that works, created the virtual folder include to point to the actual inc folder, it gets the file ok, it displays it ok, but then the links & images are still relative to the the file that called them (some sub folder), not where the include file is at (inc in root).

    What else can I try? It is possible, right?

    Can't really use full path (http://www.blah.com/somefile.....) for include, links & images as this needs to move from test server to prod, etc, w/o changing contents of files.

    I thought about base href, but a) that's in head tags only, and b) that'd set the whole page ....
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    Try using include virtual from the top of your website

    #include virtual="/images/somefile.asp"
    ======
    Doug G
    ======
    It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2004
    Posts
    4
    Rep Power
    0
    Ok, got it!

    Though our virual was on the root, and we did use /, it also needed a change in IIS, site properties, local path.

    Otherwise we were so close, yet still not getting it. Now, all three pieces work together as they should.

    Whew.

IMN logo majestic logo threadwatch logo seochat tools logo