Strange in magento footer.phtml file. I am adding a below code in footer area to place text according to current page, whether its cms page or any other page but it is not working correctly.
if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')
{
echo "CMS page";
}
else{
echo "Not a CMS page";
}
But its not working, while this code is working fine in header.phtml file provide the correct result according to page.
If I click "Flush Magento Cache" button from "Cache Storage Management" section in back-end it will work for fist time but when I change page to product or vice versa its will not works, it provide the same result all time.
Also header.phtml file code work correctly all time.
Please can anyone suggest me on this?