Best place check URL and set cookie


(Denis Olenev) #1

I need: check URL and set cookies if URL contains some GET-parameters.

For example:


if ( isset($_GET['param1']) )

{

    setcookie('param1',$_GET['param1'],strtotime('+1 minutes'));

}

What is the best place in framework to do this?

I have tried use parseUrl method of HttpRequest class, but method is called twice (may be because I have application builded by this way http://www.yiiframework.com/wiki/63/organize-directories-for-applications-with-front-end-and-back-end-using-webapplicationend-behavior/)

I can do this in main layout (views/layout/main.php), but it is wrong way I seems.