Welcome Guest, Not a member yet? Register   Sign In
How do I use $_GET data with CI's URLs?
#11

[eluser]KeyStroke[/eluser]
Why is it considered "bad" to use GET variables in the CodeIgniter community anyway? I've always thought a mix of both methods (URL and GET) is the best solution.
#12

[eluser]Colin Williams[/eluser]
I just don't see the point when you are already given clean URLs. When you need key/value pairs, do /key1/value1/key2/value2, and then use $this->uri->uri_to_assoc() to get the pairs.

I don't think it's considered "bad" so much as it is pointless.
#13

[eluser]darkhouse[/eluser]
I agree with Colin and meridimus. The whole idea of routing and clean urls is to get rid of the query string (which is actually an SEO technique if you're concerned about that at all). Since I started using CI almost a year ago, I don't think I've written $_GET at all, other than maybe the occasional $_GET me a sandwich... now I'm hungry.
#14

[eluser]KeyStroke[/eluser]
What's the advantage of using key/value pairs in the URLs over $_GET parameters? is it only for SEO purposes?

Also, when I use key/value pairs, the order of the keys and values doesn't matter, right?

(example: 'http://example.com/search/user/name/joe/city/london' is just like http://example.com/search/user/city/london/name/joe' )
#15

[eluser]Colin Williams[/eluser]
That's right, KeyStroke, the order won't matter. It's better than $_GET because simple is beautiful.
#16

[eluser]darkhouse[/eluser]
Yes,

http://example.com/search/user/name/joe/city/london

is so much nicer looking than

http://example.com/?search=user&name=joe&city=london




Theme © iAndrew 2016 - Forum software by © MyBB