Here I comes with one more quick tip for Magento, earlier we have seen tips to detect the pages in Magento. In this article I would like to share 4 ways with which you can get home page URL in Magento.
[gads]
Among these 4 methods, 3 can be used within the code and 1 method can be useful when you are dealing in admin panel CMS section for Static Blocks.
So let’s don’t waste time and have a look at the code snippets:
Option 1
[cc lang=”php”]
echo $this->getUrl(”);
[/cc]
Option 2
[cc lang=”php”]
echo Mage::getBaseUrl();
[/cc]
Option 3
[cc lang=”php”]
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
[/cc]
Option 4
This option will be used to get the home page URL in static blocks.
[cc lang=”html”]
Link to Homepage URL
[/cc]
If you aware of any other method or ways to get home page URL in Magento then consider sharing to the world by placing the comment, Because Sharing is Caring.
[gads]
If you don’t want to miss any upcoming article then subscribe to our RSS Feed via mail, Like us on Facebook or Follow us on Twitter. If you do so, I am sure you will never miss any article/freebies or updates from us.
[…] one of the earlier article we have seen 4 ways to get Magento Homepage URL. Now in this article we will see how to get Skin, Media URL in .phtml file and static […]
Thank you very much…