Yii Framework Forum: Styles for the module - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Styles for the module Rate Topic: ***** 1 Votes

#1 User is offline   frantic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 172
  • Joined: 01-March 10
  • Location:Saint-Petersburg

Posted 15 May 2010 - 11:52 AM

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?
0

#2 User is offline   frantic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 172
  • Joined: 01-March 10
  • Location:Saint-Petersburg

Posted 16 May 2010 - 06:36 AM

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.
0

#3 User is offline   frantic 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 172
  • Joined: 01-March 10
  • Location:Saint-Petersburg

Posted 16 May 2010 - 08:29 AM

It's all okay guys! Thanks for help a lot :lol:
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users