Get CMS Page Title Using URL-Key in Magento

cms

Below is my code to get CMS page title using CMS page url-key (identifer)

$formatIdentifier = "'{$_product->getUrlKey()}'";
$PageData = Mage::getModel('cms/page')->load($formatIdentifier,'identifier');
echo print_r($BuyingTitle->getData());exit;

The above code returns null, while the below code returns expected data.

$PageData = Mage::getModel('cms/page')->load('my-identifier','identifier');
echo print_r($BuyingTitle->getData());exit;

How can I pass my dynamic identifier using variable to get CMS page data ?

Thanks

Best Answer

You are adding quotes that are probably messing it up

$PageData = Mage::getModel('cms/page')->load($_product->getUrlKey(),'identifier');
echo print_r($BuyingTitle->getData());exit;

should work