How to get Current page url in magento.

Magento
Get Current page url in magento or you can find catalog url using below code. With the help of this code you can easily find current page url in magento [php] <?php $current_page = ''; /* * Check to see if its a CMS page * if it is then get the page identifier */ if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'): $current_page = Mage::getSingleton('cms/page')->getIdentifier(); endif; /* * If its not CMS page, then just get the route name */ if(empty($current_page)): $current_page = Mage::app()->getFrontController()->getRequest()->getRouteName(); endif; /* * What if its a catalog page? * Then we can get the category path :) */ /* * Or you can check all values * $current_page_array = Mage::registry('current_category'); * $current_page_array['url_path'] */ if($current_page == 'catalog'): $current_page = 'path-' . preg_replace('#[^a-z0-9]+#', '-', strtolower(Mage::registry('current_category')->getUrlPath())); endif; ?> [/php] Also if you…
Read More