Skip to content

Instantly share code, notes, and snippets.

@jimshreds
Created May 20, 2010 16:02
Show Gist options
  • Save jimshreds/407736 to your computer and use it in GitHub Desktop.
Save jimshreds/407736 to your computer and use it in GitHub Desktop.
/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($left, $right) {
if ($left != '' && $right != '') {
$class = 'sidebars';
}
else {
if ($left != '') {
$class = 'sidebar-left';
}
if ($right != '') {
$class = 'sidebar-right';
}
}
if (isset($class)) {
print ' class="'. $class .'"';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment