Setup For Non Standard Paths

Hello,

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

http://www.yiiframework.com/wiki/304/setting-application-parameters-dynamically-in-the-back-end/

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?

Bill

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:




<?php


// change the following paths if necessary

$yii=dirname(__FILE__).'/../framework/yii.php';

$config=dirname(__FILE__).'/protected/backend/config/main.php';


// 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);


require_once($yii);

Yii::createWebApplication($config)->run();




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





$backend=dirname(dirname(__FILE__));

$frontend=dirname($backend);

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


return array(

        'basePath' => $frontend,


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

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

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


        'import' => array(

        'application.models.*',

        'application.components.*',

        'backend.models.*',

        'backend.components.*',

        ),

        // ... other configurations ...

);




yet I get:





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


/var/www/html/framework/YiiBase.php(427)




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.

Thoughts?

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.