SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The path to a folder on the server without calling the domain name

    Sounds a bit strange that title, but let me explain.

    We have a main site which holds all the pics of our hotels, and there are thousands of them.

    We are in the process of building a new site, on the same server but inside a different folder.

    I have worked out the path and its

    PHP Code:
    ../../checksafetyfirst/en/admin1212/imgdata/hotel<?=$rows['foto1']

    Here is the html code and php.

    PHP Code:
    <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&amp;Id=<?=$hlist?>&amp;selectCountry=<?=$rows['country_id']?>&amp;selectRegion=<?=$rows['region_id']?>" class="bodySmall1">
    <?php
    $path 
    '../../checksafetyfirst/en'.$row['address'].'/';
    $realpath str_replace("#""%23"$path);
    ?>
    <img class="HomeFeaturedImages" src="<?php echo $realpath?>admin1212/imgdata/hotel<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?>" height="80" width="80" border="0"/></a>
    Again the image isnt being drawn out, and when i right click on the image and look at the path, its using the domain name which means its starts from the folder where the domain name is directed.

    But when i click on the image and look at the path, it is drawing out the domain name of the site im developing, rather than simply going back through the folder structure to the root level and then down to the image folder I want to draw the images out of.

    So what I get instead is this.

    http://www.mysite.co.uk/checksafetyf...amsImpJul1.jpg

    So what I want it to do, is ignore the domain name, and then start its fall from the root level through the checksafetyfirst folder.

    Hopefully that makes sense.

    Cheers

  2. #2
    SitePoint Guru r2d2's Avatar
    Join Date
    Dec 2003
    Location
    In my van, fool!
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you have a domain name pointing to a subdirectory of your main domain's directory? And the images you need are not below the new domains subdirectory? You can't use ../ to get above your root directory of your new domain.

    You may beable to create a symlink in your new subdirectory to map to the images in your existing website.

  3. #3
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi r2d2, ye thats right.

    Right I see, so that explains the sub directory domain name being pulled out.

    Your spot on though.

    I have trimmed the html code back again:

    <a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&amp;Id=<?=$hlist?>&amp;selectCountry=<?=$rows['country_id']?>&amp;selectRegion=<?=$rows['region_id']?>" class="bodySmall1">
    <img class="HomeFeaturedImages" src="admin1212/imgdata/hotel<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?>" height="80" width="80" border="0"/></a>

    So will have a look at that symlink as you suggested.

  4. #4
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK have had a look and it seems straight forward enough, and use it as below, and something is wrong because the page stops displaying up to that new code, so something isnt right. Could you have a look for me please.

    PHP Code:
    <?php
    $target 
    '../../checksafetfirst/en';
    $link 'uploads';
    symlink($target$link);
    ?> 
    <img class="HomeFeaturedImages" src="<? echo readlink($link)?>admin1212/imgdata/hotel<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?>" height="80" width="80" border="0"/></a>

  5. #5
    SitePoint Guru r2d2's Avatar
    Join Date
    Dec 2003
    Location
    In my van, fool!
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry - I didn't mean use symlink in PHP. You need to setup a symlink on the server. Eg create a symlink in the subdirectory of your new domain called 'images' which point to your image folder. Then your img src link will just be

    Code:
    src="images/hotel<?=$rows['foto1']?>"
    To create your symlink - on the command line, go to your new domains subdirectory, then enter

    Code:
    ln -s ../../checksafetyfirst/en/admin1212/imgdata/ images
    This should create a link so that images/* can access your image folder directly.

    (I should note that I don't know for definite that this will work in this situation, but its the first thing I'd try).

  6. #6
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn, we on a windows server, so think that will mean why its not working.

    Is that right?

  7. #7
    SitePoint Guru r2d2's Avatar
    Join Date
    Dec 2003
    Location
    In my van, fool!
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah right - please see last answer, but you might still be OK, depending on whether symlinks will work OK in your version of Windows.

  8. #8
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok we just giving that a go now...

    Thanks

  9. #9
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just been told that the webfiles are not located on the local server they are located on a shared storage, so we cant browse to them through command prompt.

    Is there anyway around this?

  10. #10
    SitePoint Guru r2d2's Avatar
    Join Date
    Dec 2003
    Location
    In my van, fool!
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is your 'local server'? Is it the webserver that serves both websites? and this shared storage? If this is a different server, how does the main site access them?

  11. #11
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    915
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The local server is windows 2003 using IIS 6, and it serves both websites and the shared storage is on a different server, and they connect to each other through IIS.

    I bet your starting to think you didnt bother replying to me, but cheers anyway.

  12. #12
    SitePoint Guru r2d2's Avatar
    Join Date
    Dec 2003
    Location
    In my van, fool!
    Posts
    646
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its alright I'm afraid I don't know anything about IIS though...

    Googling "IIS symlink" returns what looks like might be useful info though. I would look at trying to replicate the link that the existing site has to the shared storage. The fact that it is using some shared storage would very much imply that it should be possible to link to it from your new domain folder too.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •