Answer the question
In order to leave comments, you need to log in
Is it possible in Yii to place assets files in module directories?
Good afternoon.
There is a site on Yii. Broken down into modules. The directory structure is standard:
css/
-users/
--style1.css
--style2.css
-bids/
--style1.css
--style2.css
protected/
-modules/
--users/
--- ...
--bids/
--- ...
Answer the question
In order to leave comments, you need to log in
For example:
class AdminModule extends CWebModule {
public $baseAssetsUrl = null;
public function init() {
$this->setImport(array(
'admin.models.*',
'admin.components.*',
));
if ($this->baseAssetsUrl === null) {
$this->baseAssetsUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('admin.assets'), false, -1, (bool) YII_DEBUG);
}
}
}
Yii::app()->getClientScript()->registerCssFile($this->module->baseAssetsUrl . '/css/style.css');
To make the module standalone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question