has like getRoute() function?

sometime, i want to get the current route without additional parameters~

like in action:

echo $this->route; <-- site/misc

echo $this->route; <-- mymodule/product/list ( in module )


sometime, will want through route to get more information for moduleId, controllerId, and actionId

this function will look like:

$routeResource = Yii::app()->urlManager->parseRoute(‘user/update’);

$routeResource will have:

moduleId => null,

controllerId => user,

actionId => update,[/color]


I needed something like this so i created a BaseController then extended from it a FrontendController then from that i extended all my front end controllers. in my BaseController i have code like this


class BaseController extends CController


	public function init()





	public function beforeAction($action)


		return parent::beforeAction($action);




	 * Declares class-based actions.


	public function actions()


		return array(

			// captcha action renders the CAPTCHA image

			// this is used by the contact page








	public function routeIsActive($pattern,$controllerID,$actionID)


		if(!is_array($pattern) || !isset($pattern[0]))

			return false;






		if($matched && count($pattern)>1)


			foreach(array_splice($pattern,1) as $name=>$value)


				if(!isset($_GET[$name]) || $_GET[$name]!=$value)

					return false;


			return true;



			return $matched;



following that, to achieve what u want you can add a method eg: getActiveRoute

	public function getActiveRoute()


		$controller = $this->uniqueID;

		$action = $this->action->id;

		return $route = $controller.'/'.$action;


Then in all your controllers/views/widgets you can get the active route by calling $controllerInstance->getActiveRoute();

I figure it can be modified to deal with nested modules.

where $controllerInstance is the instance of your controller.