title: How to get the category name in product/view.phtml from product_viewed.phtml?
body: <p>How can I get the category name from product_viewed.phtml list?</p>
  
  <p>I get an error when I land on the product page <code>frontend\base\default\template\catalog/product/view.phtml</code></p>
  
  <p>if I click a product from <code>frontend\base\default\template\reports/product_viewed.phtml</code></p>
  
  <p>This is the code on my <code>view.phtml</code></p>
  
  <pre><code>&lt;?php
  $_helper = $this-&gt;helper('catalog/output');
  $_category_detail = Mage::registry('current_category');
  var_dump($_category_detail-&gt;getName()); //gives current  category name
  ?&gt;
  </code></pre>
  
  <p>This is the error I get,</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function getName() on a non-object in
    C:\xxx\frontend\base\default\template\catalog\product\view.phtml on
    line 86</p>
  </blockquote>
  
  <p>But I don't have this error, if I click the product from <code>frontend\base\default\template\catalog/product/list.phtml</code></p>
  
  <p>Any idea how can I get the <strong>category name</strong> from these two different situations?</p>