I have a SearchModule.php has the following:
class SearchModule extends CWebModule
{
// function init() { }
/**
* @return array Правила роутинга для текущего модуля
*/
function getUrlRules()
{
$customController = (Yii::app()->theme->getName() == 'test' ? 'Test' : '') . '<controller>';
return array(
$this->id.'/<controller:\w+>/<action:(SupportBlock)>/<countryId:\d+>' => $this->id.'/' . $customController . '/<action>',
$this->id.'/<controller:\w+>/<action:(SupportBlock)>/<countryId:\d+>/<cityId:\d+>' => $this->id.'/' . $customController . '/<action>',
$this->id.'/visas' => $this->id.'/visas/fullVisasInfo',
);
}
}
What I'm trying to figure out is how to use another controller IF my theme' set to 'test'. Right now it has search controllers named like HotelsController or LocationsController. What I'm trying to achieve is if theme' name set to "test", it should route all requests to TestHotelsController or TestLocationsController from the SAME URL (/search/hotels should route to TestHotelsController instead of HotelsController).
I have tried doing it by appending 'Test' to the second part of routing table, but that didn't seem to do anything.