I just set some code up in my template.php to give the body tag some usefull attributes on the way to get some more styling power. It is at a realy early state of development but it kinda works quite nice so far. It allthough became quite feature rich and I thought I'd share the code so far and see what others think. Maybe someone can help me optimise it a bit and I allthogh can see it in a module in the future. Heres what I got in my template.php:
<?php
function css_body_attributes( $arg, $is_front, $sidebar_left, $sidebar_right )
{
$uid = css_uid( $arg, $is_front );
$sec = css_section( $arg, $is_front );
$col = css_columns( $sidebar_left, $sidebar_right );
$usr = css_user( );
$osb = css_useragent( );
$lang = css_language( );
return 'id="'.$uid.'" class="'.$sec.' '.$col.' '.$usr.' '.$osb.'"';
}
function css_uid( $arg, $is_front )
{
if ( is_string($arg(2)) ) $body_id = $arg(0).'-'.$arg(1).'-'.$arg(2);
elseif ( is_string($arg(1)) ) $body_id = $arg(0).'-'.$arg(1);
elseif ( is_string($arg(0)) ) $body_id = $arg(0);
if ( $is_front ) { $body_id = 'front'; }
return 'page-'.$body_id;
}
function css_section( $arg, $is_front )
{
if ( $is_front ) { $body_class = 'front'; } else $body_class = $arg(0);
return 'section-'. $body_class;
}
function css_columns( $sidebar_left, $sidebar_right )
{
if ( $sidebar_left && $sidebar_right ) return 'column-both';