home

Search A2Z 24

How to Get the Magento CMS Page Identifier of the Current Page

X

To get the URL key / identifier of any CMS page in Magento, use the following bit of code.

<?php 
     $cmsPageUrlKey = Mage::getSingleton('cms/page')->getIdentifier();
?>

This will return the path that comes after the website's URL. For example, the URL identifier for the About Us page might be about-us and not the full URL like http://www.yourwebsite.com/about-us/. If you want the full URL including your website address, then you should use the following piece of code.

<?php 
    $cmsPageUrl = Mage::getUrl() . Mage::getSingleton('cms/page')->getIdentifier();
?>

About Author

by Admin

Share your thoughts!

Login as a member to access comment posting block !! click-here

Thoughts From Other Users (0)

No Comments

×