SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Passing several variables by URL without using a query string?

    Using the popular method of implementing search engine friendly urls I would have something like..

    ex.
    www.mysite/members/ (Display member listing)
    www.mysite/members/jayfive/ (Display member jayfive)


    Lets say on the "Display member listing" page I had a table listing the members with columns for username,gender,location,age etc.

    Now I want to be able to re-order the member listing table by any field (username,gender,location,age) *while* not having to resort to using a query string "?orderBy=username&dir=ASC"

    Has anyone figured out how to get around this problem? I know search engines don't ignore urls with query strings but I want to avoid using them for this example.

    I hope I didn't confuse anyone..

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <form ... method="post"> ?

    Edit:


    ...or maybe not? First I thought you had a button somewhere near a table header, and the user could click to change ASC to DESC etc...

    Just add more "parameters" to the url?
    Like http://example.com/members/username/asc

    NB! The usernames "username", "location", "gender" etc must be "reserved", i.e. allow no user to register the name "username".

  3. #3
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It will depend on how you implement the clean urls. But there's nothing stopping you from having www.mysite.com/members/order/username/desc (you'de have to make sure no member could have the username of order though so as to not confuse with /members/someuser)

    If you use apache's ForceType then it will look for desc, username, order, members in that order, so if you have a file called members (no .php extension) then it will load that page. Then you can use $_SERVER['PATH_INFO'] or $_SERVER['REQUEST_URI'] to parse out the variables (order, username and desc) to decide how to order the display.

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks for the replys..

    umm I've seen a site that has urls like:

    www.mysite.com/buy/products__keyword--california%20duster,cat_id--22000100,mid--33851.html

    How would I implement something like this in PHP?

  5. #5
    PHP manual bot bronze trophy Gaheris's Avatar
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mod_rewrite and $_SERVER['REQUEST_PATH']


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
  •