Skip to content

acorncom/BodyClassBehavior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published