I Can't Get Controllernamespace To Work

My Yii app uses different controllers (and views) depending on the sub domain, so I need to map the controller folder accordingly.

As a test, I’ve moved all the controllers into a subfolder of the normal controller folder and the put the following in main.php config. The subfolder is named ‘client’




"controllerNamespace" => "application.controllers.client",



As I understand it this should route all controller actions to this folder but it is not working. I get an ‘Unable to resolve the request “site/error”’ for all pages.

In stepping through CWebApplication I don’t understand how it could work as the controllerNamespace is applied after the $classFile path is created.




    ...

    $className=ucfirst($id).'Controller';

    $classFile=$basePath.DIRECTORY_SEPARATOR.$className.'.php';


    if($owner->controllerNamespace!==null)

        $className=$owner->controllerNamespace.'\\'.$className;


    if(is_file($classFile))

    ...



What am I doing wrong?

Yii version 1.1.14.f0fee9

I guess it should work if you put your controller under controllers/client. remove the controller namespace from config

I need to be able to dynamically set the folder to use for controllers. I can’t just hard code it.

I’ve solved this by extending CWebApplication (instructions on how found here)

But I would really like to know if this is possible to do natively.