How to Get Current Category Id or Name in Magento

get Current category in magento is so much easy

If you wish to check the current category in everypage(including Homepage as default category is 2) then you can write these code

$_cat = new Mage_Catalog_Block_Navigation();
$curent_cat = $_cat->getCurrentCategory();
$curent_cat_id = $curent_cat->getId();
 
$category = Mage::registry('current_category')->getName();

By the Help of registry()function of magento we can get the Current category ,For get name of that category we can use getName() function .If you need the Id then write getId() instead of getName();

DOWNLOAD SOLUTION HERE