Custom directory for Controller


can I use the Controller which is outside of "protected/controllers/" directory?

I’m having some common CMS-like code for quick set-up of websites which basically is a highly configurable application. Each of the websites I create has it’s own directory and own configuration file, which basePath points to the common code (like: “‘basePath’=>dirname(FILE).DIRECTORY_SEPARATOR.’../mg-cms/protected’,”).

This way the website might consist of 3 files only - index.php, config.php and a directory which contains website-specific theme.

However under some rare circumstances the website needs to have it’s very own controller. That is the point where custom controller directory would be very useful, since I could keep it inside the website directory and avoid messing the common code.

The only solution I thought of so far is to create an website-specific module, like this (note: wrs is an abberviation of website name :) )

  • wrs-module[list]

  • WrsModule.php

  • controllers[list]

  • WrsController.php



than, the configuration is following:


Yii::setPathOfAlias('wrs', dirname(__FILE__).'/wrs-module/');

return array(



	'theme' => 'wrs',

	'defaultController' => 'wrs/wrs',

// ....


		'wrs' => array(

			'class' => 'wrs.WrsModule'



I’m not sure however this is the most proper way :)