Absolute/Virtual Path for images

Discussion in 'ASP General' started by Rob, Mar 8, 2005.

  1. Rob

    Rob Guest

    I have a web project that has multiple directories. Some of the files in
    different directories use the same include files. The problem is that these
    include files also reference an image folder. I am trying to create an
    absolute reference to these images so I don't have to make the same include
    for different directories. What is the best way to do this?

    Thanks.
     
    Rob, Mar 8, 2005
    #1
    1. Advertising

  2. Rob

    Evertjan. Guest

    Rob wrote on 08 mrt 2005 in microsoft.public.inetserver.asp.general:

    > I have a web project that has multiple directories. Some of the files
    > in different directories use the same include files. The problem is
    > that these include files also reference an image folder. I am trying
    > to create an absolute reference to these images so I don't have to
    > make the same include for different directories. What is the best way
    > to do this?
    >


    Just define them absolute absolutely:

    <img src="/mydir/mydirToo/myimg.jpg">

    > so I don't have to make the same include for different directories.


    You mean ".. different includes for different ..." , I suppose?

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Mar 8, 2005
    #2
    1. Advertising

  3. Rob

    Dave Guest

    <image src="/images/yourimage.gif">

    "/..." always relates to the root.

    "Rob" <> wrote in message
    news:...
    > I have a web project that has multiple directories. Some of the files in
    > different directories use the same include files. The problem is that

    these
    > include files also reference an image folder. I am trying to create an
    > absolute reference to these images so I don't have to make the same

    include
    > for different directories. What is the best way to do this?
    >
    > Thanks.
    >
    >
    >
     
    Dave, Mar 8, 2005
    #3
  4. Rob

    Rob Guest

    /images does not work. Any ideas why?

    Thanks.



    "Dave" <> wrote in message
    news:eRV0Uu$...
    >
    > <image src="/images/yourimage.gif">
    >
    > "/..." always relates to the root.
    >
    > "Rob" <> wrote in message
    > news:...
    >> I have a web project that has multiple directories. Some of the files in
    >> different directories use the same include files. The problem is that

    > these
    >> include files also reference an image folder. I am trying to create an
    >> absolute reference to these images so I don't have to make the same

    > include
    >> for different directories. What is the best way to do this?
    >>
    >> Thanks.
    >>
    >>
    >>

    >
    >
     
    Rob, Mar 8, 2005
    #4
  5. Rob

    Roland Hall Guest

    "Rob" wrote in message news:...
    :I have a web project that has multiple directories. Some of the files in
    : different directories use the same include files. The problem is that
    these
    : include files also reference an image folder. I am trying to create an
    : absolute reference to these images so I don't have to make the same
    include
    : for different directories. What is the best way to do this?

    Hi Rob...

    It would be helpful to know what your subdirectory names are but as an
    example, here is what I do.

    I create a config.asp file. This is where I put customized variables.
    I also create a common.asp file and a header.asp file.
    In the common.asp, I put common subs/functions that I use throughout my
    site.
    In header.asp is where I put the header I use on each page and I link in my
    common.asp which links in my config.asp.

    ' o--> config.asp <--o
    <%
    Option Explicit
    Response.Buffer = True

    Const imgPath = "/images/"
    ..
    ..
    ..
    %>

    ' o--> common.asp <--o
    <!--#include virtual="/asp/config.asp"-->
    <%
    sub prt(str)
    Response.Write str & vbCrLf
    end sub

    sub lprt(str)
    Response.Write str & "<br />" & vbCrLf
    end sub

    function someFunction(someValue)
    ..
    ..
    end function
    ..
    ..
    %>

    ' o--> header.asp <--o
    <!--#include virtual="/asp/common.asp"-->
    <%
    ..
    ..
    ..
    %>

    ' o--> All other pages <--o
    <%@ Language="VBScript" %>
    <%
    Option Explicit
    Response.Buffer = True
    %>
    <!--#include virtual="/asp/header.asp"-->
    <%
    ..
    ..

    prt "<div><span><img id=""img1"" class=""blockImages"" src=""" & imgPath &
    "myimage.jpg"" /></span></div>"


    %>

    HTH...

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Mar 8, 2005
    #5
    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. Matt
    Replies:
    3
    Views:
    19,579
    Sudsy
    Jul 8, 2004
  2. Replies:
    10
    Views:
    3,607
  3. =?Utf-8?B?SmVmZiBCZWVt?=

    physical path to virtual path under virtual directory

    =?Utf-8?B?SmVmZiBCZWVt?=, Aug 1, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    1,056
    Eliyahu Goldin
    Aug 1, 2007
  4. Wayne
    Replies:
    5
    Views:
    162
    Pravin Patil
    Feb 1, 2004
  5. James Byrne
    Replies:
    3
    Views:
    570
    James Byrne
    Sep 14, 2010
Loading...

Share This Page