MD.MD
MD.MD

Reputation: 718

how to import dir from outside the application in Yii?

I have a Yii webapp named A, and a second webapp named B that is inside A, I want to import A/protected/vendors/ in some B controllers, so I want to write in the controller something like:

Yii::import('/../application.vendors.*');

how I can do that ?

Upvotes: 1

Views: 166

Answers (1)

Noam148
Noam148

Reputation: 113

Set a path alias (to webapp A) on the top of your config file of webapp B (protected/config/main.php) for example:

Yii::setPathOfAlias('absolutePathToWebAppA', '/home/user/domains/site.com/public_html');

And in your controller in webapp B:

Yii::import('absolutePathToWebAppA.protected.vendors.*');

Upvotes: 2

Related Questions