title: Get category URL key in Magento
body: <p>How do I get the URL key of a category in Magento. I have added this text in URL key field the CMS:</p>
  
  <pre><code>Category-1
  </code></pre>
  
  <p>This is how I'm currently trying to show my category URL in an anchor:</p>
  
  <pre><code>$_categories = Mage::getModel('catalog/category')-&gt;getCollection()
                       -&gt;addAttributeToSelect('name')
                       -&gt;addAttributeToSelect('is_active');
  
  &lt;?php foreach($_categories as $_category): ?&gt;
  &lt;a href="&lt;?php echo $_category-&gt;getCategoryUrl($_category); ?&gt;"&gt;
    &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>But whenever I check my output it still shows like this:</p>
  
  <pre><code>&lt;a href=""&gt;
              &lt;span&gt;Manual Tile Cutters&lt;/span&gt;
          &lt;/a&gt;
  </code></pre>
  
  <p>I have already checked google and the magento forums for this, but I still cannot find a sufficient answer.</p>
  
  <p>Also, is what I'm trying to call in the anchor the URL key, or is it a different URL?</p>