Just for completeness sake, here is an example of index.php rewritten for a custom app
$yii='../../yii/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// Check access
require_once($yii);
require_once(dirname(__FILE__).'/protected/config/CMSApplication.php');
$app = new CMSApplication($config);
$app->run();
ΙΜΗΟ the CWebApplication resembles a lot like a CWebModule so it might be a good idea for a later version of Yii to have even the top level of the application as a module.
I mean to be forced by design like this!
I am not using this approach right now as extensively as I would like due to extensions that have references as ‘application.models…’ or ‘application.controllers…’
I had a case to extend the CWebApplication class but there was a caveat, the $_controller property of CWebApplication is private which must be changed to protected so that someone can extend to have their own version of CWebApplication class.
Ain’t it’s feasible to make all the properties of CWebApplication protected instead of private in the next version of Yii core so that anyone can extend this class easily?