Get products based on category id Magento

<?php

$layer = Mage::getSingleton(“catalog/layer”);

$_category = $layer->getCurrentCategory();

 

$category = new Mage_Catalog_Model_Category();

$category->load($_category->getId());

$prodCollection = $category->getProductCollection();

foreach ($prodCollection as $product) {

}

?>