Sometimes when you are customizing your Magento files that you want to get current category ID or name. Here ,easy method to get current category ID or name in Magento.This will direct return category ID or name.
getCurrentCategory()->getId(); // get category name echo Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); ?>