• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing affiliate ID on ANY url, friendly url's and query string together

#1
[eluser]Unknown[/eluser]
My apologies if this has been asked already, but I cannot find the answer.

I am currently running a site using CI friendly urls and everything is peachy.

I'm adding an affiliate system, and would like members to be able to pass in their affiliate IDs using ANY url.

eg.

http://www.mysite.com/controller/method1...2?a=123456
OR
http://www.mysite.com/controller/method2?a=123456
etc.

Where 123456 is their ID.

I figure this would be easiest to accomplish with the query string, and having every controller check for it when it loads, and set a session variable. Reading the user's guide, it seems like it is only possible to use either the query string or friendly URLs, not both.

Has anybody accomplished something similar to this and care to share their solution? Or at least point me to an appropriate thread which discusses the topic?

Thank you kindly in advance.

#2
[eluser]TheFuzzy0ne[/eluser]
I wanted a way to use key-value pairs without using query strings, so I wrote an [url="http://ellislab.com/forums/viewthread/106502/"]Alternate URI Syntax library[/url]. It might help you.

#3
[eluser]Unknown[/eluser]
Thank you for the reply TheFuzzy0ne, your library is great, I'll probably use it for another part of my site. Unfortunately, it doesn't do exactly what I need in this case.

The good news is I've found another solution,
for anyone interested -> http://ellislab.com/forums/viewthread/56389

#4
[eluser]TheFuzzy0ne[/eluser]
Thanks for posting your solution, and welcome to the CodeIgniter community. Smile

#5
[eluser]tomcode[/eluser]
Sticking with CI friendly urls You could could add as LAST pair /myident/123456 and then check the presence of the myident segment in every controller.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.