Get the current category description in Joomla 3.1.5

Get the current category description in Joomla 3.1.5

I was working through getting the category description for my custom component in the cleanest way possible without doing multiple queries or echoing out the $list value (because it repeats sub-cat descriptions too). Put this above, that is, outside the $list loop for your view or add it to a helper and echo as needed, usually only once on the page.

<?php // tested in Joomla 3 only
$app = JFactory::getApplication();
$catID = $app->input->get('cat_id');
//echo $catID;

$db = JFactory::getDBO();
$db->setQuery("SELECT description FROM #__categories WHERE id = ".$catID." LIMIT 1;");
$catDesc = $db->loadResult();
?>

<div class="catdesc">
  <?php echo $catDesc; ?>
</div>

Hope this helps someone out there :)