Custom directory for Controller

Hi,

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

[/list]

[/list]

than, the configuration is following:




<?php

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

return array(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../mg-cms/protected',

	'name'=>'WRS',

	'theme' => 'wrs',

	'defaultController' => 'wrs/wrs',

// ....

	'modules'=>array(

		'wrs' => array(

			'class' => 'wrs.WrsModule'

		)

	),



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