SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    back to the root folder

    in need to get the graphics from the it's root folder

    my page is in a folder called /esp
    and the images are in a folder called ornament , and that folder is in a nother folder called grahpics
    how do i get this script to alway go back to the root then look into the grahics folder
    i tried putting a "/" infront but itstill not working

    here is the code

    PHP Code:
    <?php
      $images 
    = array();

    foreach(
    glob("graphics/ornament/*.jpg") as $filename)
    {
        
    array_push($images$filename);
    }

    $index mt_rand(0, (count($images)-1));

    echo 
    "<img src=\"/$images[$index]\"/>"


    ?>
    any idea any one

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    ../ takes you one 'level' above the current directory
    ../../ takes you two 'levels' above the current directory
    ../../../ you guessed it,
    etc....
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    and to always get to the root folder

    that muck i do get ,

    for some reason it doesn't listen with this code

    how do i alway go to the root then
    the thing is i am including the file from the root to a file that is in a folder
    i am also using a file that is in the root that uses this script

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    if ../ 'ing doesn't work, use absolute links: http://www.mysite.com etc

    That should force the issue.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •