How to acces the same dir from different dirs..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Timo J

    How to acces the same dir from different dirs..

    Hi - I cant fins the right way to put this problem..

    I have a structore wich is like this..



    And from a dir


    and


    i like to include the same image pic.jpg, with the same code but i cant get
    it to work..

    I have tried.. include("/images/pic.jpg"); and the below but none work..

    /images/pic.jpg
    images/pic.jpg
    //images/pic.jpg
    \images\pic.jpg
    images\pic.jpg
    \\images\pic.jp g

    What am i doing wrong..

    Best regards

    Timo.


  • Erwin Moller

    #2
    Re: How to acces the same dir from different dirs..

    Timo J wrote:
    [color=blue]
    > Hi - I cant fins the right way to put this problem..
    >
    > I have a structore wich is like this..
    >
    > www.thewebsite.dk/images/
    >
    > And from a dir
    >
    > https://www.thewebsite.dk/something/...gelse/test.php[/color]

    try:

    include '../../images/pic.jpg';

    from here.
    .../ means 'up one directory'
    [color=blue]
    > and
    > www.thewebsite.dk/something/test.php[/color]

    try:

    include '../images/pic.jpg';

    [color=blue]
    >
    > i like to include the same image pic.jpg, with the same code but i cant
    > get it to work..
    >
    > I have tried.. include("/images/pic.jpg"); and the below but none work..
    >
    > /images/pic.jpg
    > images/pic.jpg
    > //images/pic.jpg
    > \images\pic.jpg
    > images\pic.jpg
    > \\images\pic.jp g
    >
    > What am i doing wrong..
    >
    > Best regards
    >
    > Timo.[/color]


    Regards,
    Erwin Moller

    Comment

    • Timo J

      #3
      Re: How to acces the same dir from different dirs..

      Yep thats will do the trick - but i where hoping that there where some
      syntax so that i where able of useing the same code manny places without
      changing it..

      But thanks anyway

      Timo



      "Erwin Moller"
      <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> skrev i en
      meddelelse news:4016573a$0 $323$e4fe514c@n ews.xs4all.nl.. .[color=blue]
      > Timo J wrote:
      >[color=green]
      > > Hi - I cant fins the right way to put this problem..
      > >
      > > I have a structore wich is like this..
      > >
      > > www.thewebsite.dk/images/
      > >
      > > And from a dir
      > >
      > > https://www.thewebsite.dk/something/...gelse/test.php[/color]
      >
      > try:
      >
      > include '../../images/pic.jpg';
      >
      > from here.
      > ../ means 'up one directory'
      >[color=green]
      > > and
      > > www.thewebsite.dk/something/test.php[/color]
      >
      > try:
      >
      > include '../images/pic.jpg';
      >
      >[color=green]
      > >
      > > i like to include the same image pic.jpg, with the same code but i cant
      > > get it to work..
      > >
      > > I have tried.. include("/images/pic.jpg"); and the below but none work..
      > >
      > > /images/pic.jpg
      > > images/pic.jpg
      > > //images/pic.jpg
      > > \images\pic.jpg
      > > images\pic.jpg
      > > \\images\pic.jp g
      > >
      > > What am i doing wrong..
      > >
      > > Best regards
      > >
      > > Timo.[/color]
      >
      >
      > Regards,
      > Erwin Moller[/color]


      Comment

      • Jon Kraft

        #4
        Re: How to acces the same dir from different dirs..

        "Timo J" <Timo*Remove* @s-d-i.dk> wrote:
        [color=blue]
        > I have a structore wich is like this..
        >
        > www.thewebsite.dk/images/
        >
        > And from a dir
        >
        > https://www.thewebsite.dk/something/...gelse/test.php
        > and
        > www.thewebsite.dk/something/test.php
        >
        > i like to include the same image pic.jpg, with the same code but i
        > cant get it to work..
        >
        > I have tried.. include("/images/pic.jpg"); and the below but none
        > work..[/color]

        Hi Timo,

        include() doesn't expect a URL (unless prepended by http/ftp. etc.) but a
        system path. So use the full system path, e.g.:

        include("/www/docroot/images/pic.jpg");

        HTH;
        JOn

        Comment

        • Erwin Moller

          #5
          Re: How to acces the same dir from different dirs..

          Timo J wrote:
          [color=blue]
          > Yep thats will do the trick - but i where hoping that there where some
          > syntax so that i where able of useing the same code manny places without
          > changing it..[/color]

          In that situation a complete URI will do the trick.

          use:

          <img src="http://www.thewebsite. dk/images/pic.jpg">

          which will always point to the right location.
          Because imageloading is done by the browser, I expect it to be as fast as
          .../../etc. notation.
          Except when your browser does a namelookup every time, which I hope it
          doesn't. :P

          Regards,
          Erwin Moller


          Comment

          • Kre¹o Kunjas

            #6
            Re: How to acces the same dir from different dirs..

            On Tue, 27 Jan 2004 13:24:36 +0100, Timo J wrote:
            [color=blue]
            > Yep thats will do the trick - but i where hoping that there where some
            > syntax so that i where able of useing the same code manny places without
            > changing it..
            >
            > But thanks anyway
            >[/color]
            try using server constant DOCUMENT_ROOT if relative addressing doesnt work
            for you

            example

            $homedir = $_SERVER["DOCUMENT_R OOT"].$mydir;

            Comment

            • Timo J

              #7
              Re: How to acces the same dir from different dirs..


              "Kre¹o Kunjas" <deresh@gamebox .net> skrev i en meddelelse
              news:sggcp1o1uq c.1fkd3gbsnmwxv .dlg@40tude.net ...[color=blue]
              > On Tue, 27 Jan 2004 13:24:36 +0100, Timo J wrote:
              >[color=green]
              > > Yep thats will do the trick - but i where hoping that there where some
              > > syntax so that i where able of useing the same code manny places without
              > > changing it..
              > >
              > > But thanks anyway
              > >[/color]
              > try using server constant DOCUMENT_ROOT if relative addressing doesnt work
              > for you
              >
              > example
              >
              > $homedir = $_SERVER["DOCUMENT_R OOT"].$mydir;[/color]

              Perfect.... just the rigth stuff!

              Thanks All !

              Timo.



              Comment

              Working...