As you know, To make a menu in yii, we can use Cmenu widgets. It’s very helpful to make a menu for website.
But sometimes, we need to make it by coding our own menu. How can we bind active class CSS to our menu. This time, we need to check controller and action name in URL for matching with the menu.
Here is the way to do it

<?php echo ($this->uniqueId == 'controller_name' && $this->action->id == 'action_name') ?>

It’s simple. Now you can handle request with CSS like mime done.

<li <?php echo ($this->uniqueId == 'site' && $this->action->id == 'index')?'class="active"':''; ?> >
 <a href="<?php echo Yii::app()->baseUrl;?>">Home</a>
  <div class="hover"></div>