SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Camas, WA (USA)
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Extracting folder names in navigation

    I'd like to be able to extract the folder names in my site as variables, but I haven't figured out how yet. I'm assuming that I could do an explode on $_SERVER['PHP_SELF'] based on "/" or something, but is there a built-in way of doing this?

    I'd like to be able to take:
    www.mysite.com/catalog/section/subsection
    and use the different parts, like:
    You are in the SUBSECTION area of SECTION in the CATALOG

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Something like...
    PHP Code:
    $page explode("/"$_SERVER['PHP_SELF']);
    print_r($page); 
    I have done the print_r so that you can see the array and the keys [0], [1] etc
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I do not think that there is a built-in function for this, so you will probably have to use explode().

    Yours, Erik.
    ERIK RIKLUND :: Yes, I've been gone quite a while.


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
  •