Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 25, 2012, 08:09:13 AM

Pages: [1]   Go Down
  Print  
Author Topic: Retrieving URL paths in Magento  (Read 9422 times)
AndrewJohn26
Trekkie
**
Offline Offline

Posts: 14


« on: April 26, 2011, 07:16:00 AM »

Any one please hlep me in Retrieving URL paths in Magento
Logged
mtthwsmith8
Newbie
*
Offline Offline

Posts: 5


WWW
« Reply #1 on: April 30, 2011, 05:01:33 AM »

As we know, Magento comes with built in function for retrieving URL paths. Function is called getBaseUrl() and its located under Mage class.
But this function is not documented as it should be. Documentation only states that function retrieves $type parametar which is by default equal to “base”.
Here is the list of all the available parameters which they had, and they all come from Mage_Core_Model_Store.

•Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
http://your.domain/js/

•Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
http://your.domain/index.php/

•Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
http://your.domain/media/

•Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
http://your.domain/skin/

•Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
http://your.domain/

Where http://your.domain/ is the url of your site. If you don’t provide any parameters to getBaseUrl() function you would retrieve the same path as with URL_TYPE_LINK parameter.
Remember, you need to echo out these statements to the browser, because they each return a string, so you need to output that string like.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to: