Magento: Getting product type

I got product type following way in phtml file

$product=Mage::getModel('catalog/product')->load($product_id);
$productType=$product->getTypeID();
//Simple Product    
if($productType == 'simple')
{   
  echo "Simple Product";
}                           
//Configurable Product
if($productType == 'configurable')
{   
  echo "Configurable Product";
}

Source:
http://stackoverflow.com/a/12419301