How to get the URL of a CMS page or a static block in Magento

April 19th, 2017

Warning: This post is 6 years old. Some of this information may be out of date.

Here's how to get the URL of a CMS page or a static block in Magento.

Using the block or page Id:

    <?php echo Mage::helper('cms/page')->getPageUrl( 1 ) ?>

Using the key:

In another cms block or page:

    {{store _direct="url_key"}}

In a template file:

    <?php echo Mage::helper('cms/page')->getPageUrl('url_key') ?>