Setup For Non Standard Paths


I’m trying to implement a dynamic configuration per this post:

The technique places the controller, model, and views in a protected/backend directory. The tutorial doesn’t explain the details of using this… I’m new so its not obvious to me. First I needed a way to access the controller. So I added a controllerMap entry. That got me past that only to have the error where the model class was not found. So I added a import for application.backend.models. Now I have the error where the index view is not found.

So what is the way to handle this? There must be a better way. Seems like I should create a module for this instead?


Well I missed the link at the top of the referenced post so I now have more info but I still have a problem. It acts like the standard Controller is being used instead of the one for backend.

My backend.php script is:


// change the following paths if necessary



// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);



and my protected/backend/config/main.php is:



Yii::setPathOfAlias('backend', $backend);

return array(

        'basePath' => $frontend,

        'controllerPath' => $backend.'/controllers',

        'viewPath' => $backend.'/views',

        'runtimePath' => $backend.'/runtime',

        'import' => array(






        // ... other configurations ...


yet I get:

include(Controller.php): failed to open stream: No such file or directory


What am I doing wrong?????

Help? Anyone? I think I had the URL wrong before and the route defaulted to the frontend. Using: http://host/backend.php?r=config results in

Page Not Found

Unable to resolve the request "config".

Another thing, regardless of what I put in backend.php, I can’t seem to affect its execution. Writing to the log, running die() don’t do anything. Yet if I move that file out of the way I definitely get a file not found error so it is being referenced.


Ah the dangers of cut & paste. The tutorial drops off the <?php tag. So did I when I copied it! Can’t believe it took me so long to sort this out. Odd that nothing showed in the logs for this.