Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    url category type variables

    Hey guys,

    I know i've scene this before but i was wondering how it was done. Say you had a url like..

    somewhere.com/index.php/About/Services

    The "About" and the "Services" are actually url variables, but passed that way instead of...

    somwhere.com/index.php?variable1=About&variable2=Services

    So in the first example it would be predefined that the first set of slashes holds "variable1" and the second set holds "variable2" and i would be able to reference them anywhere just as i would a normal url variable.

    Any advice would be great. I'd really like to figure out how this is done.

    Thanks

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,106
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Some use Apache's ModRewrite , others note that the server variable $_SERVER['PATH_INFO'] will hold `/About/Services`

    so with
    PHP Code:
    <?$bits=explode('/',$_SERVER['PATH_INFO']);?>
    $bits will be an array 0=>'',1=>About,2=>Services

    These days I use the PATH INFO route but note that it does have several drawbacks, ModRewrite is probably easier assuming your Apache installation has the module available.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    great... thank you i'll look into both options.


  •  

    Posting Permissions

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