SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member jmweb's Avatar
    Join Date
    Jan 2004
    Location
    Canada
    Posts
    1,481
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $id = what ever is between / and /

    I am going to have a url system setup where I want the number between the last two /'s to be taken from the url and given the value of $id.


    For instance if someone goes to
    www.domain.com/ralph/id/1/
    i want $id to = 1

    if they go to www.domain.com/ralph/id/1333/
    I want $id to = 1333

    Any samples on how to set this up? Or can someone provide me with some help on this...

  2. #2
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    you can use htaccess to do it useing RewriteRule
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  3. #3
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or, if you don't feel comfortable fiddling with htaccess, you could use:
    PHP Code:
    $url split("/",$_SERVER["PHP_SELF"]);
    $id $url[count($url)-1]; 


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
  •