Use module files from another path

I want to achieve loading one specific module without having it in the application/modules folder.

It works for the module class file, but I am having problems with path resolving for included module files.

Example: I am using the RBAM extension/module with the following configuration:


'modules' => array(

	'rbam'=>array(

		'class' => 'path.to.external.modules.rbam.RbamModule',

	),

),

This correctly loads the module file, but whenever a path is resolved like…


$this->widget('rbam.extensions.alphapager.ApGridView'

… it is resolved to the regular module path under application/modules/rbam/etcetera, instead of path/to/external/modules/rbam/etcetera.


'No such file or directory' on include(C:\www\test\application\modules\rbam\extensions\alphapager\ApLinkPager.php)

Can I solve this?

seems the pathAlias of "rbam" is wrong . test it firstly :




echo Yii::getPathOfAlias('rbam');



may be you should track the widget function call stack ,debug the place where the error message output

the most possible is the setPathOfAlias() set a wrong path string , check it ::)

may be is the widget ApGridView treat the ApLinkPager class path under the …modules\rbam\extensions\alphapager\ApLinkPager.php , read the source code :P

Alright, I think it works now!

It was a bit buggy, until I remembered include() results are cached. Calling clearstatcache() fixed my problem and I can now use the module externally :)

See: http://php.net/manual/en/function.clearstatcache.php