Welcome Guest, Not a member yet? Register   Sign In
nice referral link
#7

[eluser]drewbee[/eluser]
I actually had a requirement for this, except for the fact that it could be attached to ANY uri. Obviously i wasn't going to hard code this into every controller.

I used the pre_controller hook to handle this situation as well as cookies.

Pre Controller hook: (note: most of CI is not intiallized by this point, so we just have to do some good old fashion PHP'in here);

Code:
if (isset($_GET['refid'))
{
    setcookie('refid', $_GET['refid'], strtotime('3 months'), '', '/');
    // We have to unset the get variable so codeigniter doesn't freakout about it
    unset($_GET['refid']);
}

Now anywhere in our application we can simply retrieve the cookie data as needed.

As well, any page can now be used as a referal page.

/controller/method/param/param.html?refid=drewbee

/controller.html?refid=drewbee

etc.


Messages In This Thread
nice referral link - by El Forum - 03-09-2009, 08:42 AM
nice referral link - by El Forum - 03-09-2009, 08:45 AM
nice referral link - by El Forum - 03-09-2009, 08:58 AM
nice referral link - by El Forum - 03-09-2009, 09:00 AM
nice referral link - by El Forum - 03-09-2009, 09:09 AM
nice referral link - by El Forum - 03-09-2009, 09:29 AM
nice referral link - by El Forum - 03-09-2009, 01:05 PM
nice referral link - by El Forum - 03-10-2009, 09:05 AM
nice referral link - by El Forum - 03-10-2009, 12:23 PM
nice referral link - by El Forum - 03-11-2009, 02:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB