Don't know if it's efficient or elegant, but this is what I do:
<?php
$db = &JFactory::getDBO();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$temp = JRequest::getString('id');
$temp = explode(':', $temp);
$id = $temp[0];
if ($option == 'com_content' && $id)
{
/* Checking if we are making up an article page */
if ($view == 'article')
{
/* Trying to get CATEGORY title from DB */
$db->setQuery('SELECT `catid` FROM #__content WHERE id='.$id);
$catid = $db->loadResult();
}
/* Checking if we are making up a category page */
if ($view == 'category')
{
/* Trying to get CATEGORY title from DB */
$db->setQuery('SELECT `catid` FROM #__content WHERE id='.$id);
$catid = $db->loadResult();
}
/* Printing category title*/
if ($catid)
{
//echo $catid;
}
}
?>
<?php
$menu = & JSite::getMenu();
$isHome = ($menu->getActive() == $menu->getDefault())?"ishome":"isNotHome";
$menusectID = "menusectID" . JRequest::getVar( 'Itemid', 0 );
?>
</head>
<body class="<?php echo $isHome; ?> <?php echo $menusectID; ?> <?php echo 'categoryid' . $catid; ?>">
I know that's more than what you're seeking.
--
Harper Vance Web Services3425 Grayling Place
Toledo, OH 43623
419-754-6166Randy Williams
http://harpervance.com
Joomla Development, Hosting, and Consulting