I have installed YII2 of my local server and I want to include separate css file from specific view or controller action, I have used a method but the method on include one css file in my specific view , could any one answer me for the solution my code is below. The firs file is include and the remaining is ignored.
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/iCheck/flat/blue.css", [
'depends' => [BootstrapAsset::className()],
'media' => 'screen',
], 'css-screen-theme');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/morris/morris.css", [
'depends' => [BootstrapAsset::className()],
'media' => 'screen',
], 'css-screen-theme');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/jvectormap/jquery-jvectormap-1.2.2.css", [
'depends' => [BootstrapAsset::className()],
'media' => 'screen',
], 'css-screen-theme');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/datepicker/datepicker3.css", [
'depends' => [BootstrapAsset::className()],
'media' => 'screen',
], 'css-screen-theme');
Just remove one parameter from the above code , the remaining code is correct.I am sending an example for modified code.
this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/iCheck/flat/blue.css", [ 'depends' => [BootstrapAsset::className()], 'media' => 'screen', ], '');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/morris/morris.css", [ 'depends' => [BootstrapAsset::className()], 'media' => 'screen', ], '');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/jvectormap/jquery-jvectormap-1.2.2.css", [ 'depends' => [BootstrapAsset::className()], 'media' => 'screen', ], '');
$this->registerCssFile(Yii::$app->request->BaseUrl."/assets/plugins/datepicker/datepicker3.css", [ 'depends' => [BootstrapAsset::className()], 'media' => 'screen', ], ''); Now all the css files will be shown now.