Hi!
Where should I place the css files for the module? I guess I should use AssetManager. In this case I need to create the asset folder under the module directory. Or does another alternative exists?
Hi!
Where should I place the css files for the module? I guess I should use AssetManager. In this case I need to create the asset folder under the module directory. Or does another alternative exists?
I place my styles in modules/admin/assets folder and in modules/admin/components/Controller.php I wrote:
class Controller extends CController
{
public $layout='application.modules.admin.views.layouts.admin';
public $headline;
public $assets;
public $menu=array();
public $breadcrumbs=array();
public function init()
{
$this->assets = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.admin.assets'), false, -1, true);
}
}
And in layout file modules/admin/views/layouts/admin.php:
....
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<?php Yii::app()->clientScript->registerCssFile($this->assets.'/css/admin.css'); ?>
<?php Yii::app()->clientScript->registerCssFile($this->assets.'/css/form.css'); ?>
</head>
But variable assets is empty from this place. I can’t understand why.
It’s all okay guys! Thanks for help a lot