Skip to content
 
 

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

This behavior makes adding CSS body classes to your layouts quite simple

Unpack release in the protected/extensions folder.

Then add the behavior to a controller (or even better to your components/Controller.php):

public function behaviors() {
	return array(
              'BodyClassBehavior' => array( 
                     'class' => 'ext.BodyClassBehavior.BodyClassBehavior'
              ),
              ...
	);
}

In your layouts/main.php view, add to your body tag:

</head>
...
<body class="<?php echo $this->getBodyClasses(); ?>">

And you're done!

Code in this credit to Artifical and Nick Matthews (see http://www.yiiframework.com/forum/index.php/topic/28849-body-classes-based-on-url/)

About

A Yii behavior that makes adding CSS body classes to your layouts quite simple

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages