PDA

View Full Version : Retrieving URL paths in Magento



AndrewJohn26
05-16-2011, 06:26 AM
Retrieving URL paths in Magento...?

jonathan cole
05-16-2011, 07:42 AM
What you want to ask ?

jamsl
05-31-2011, 09:00 AM
HI Andrew,


Magento comes with built in function for retrieving URL paths. Function is called getBaseUrl() and its located under Mage class. However, function is not documented as it should be. Documentation only states that function retrieves $type parametar which is by default equal to “base”.

Example:
<?php
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_W EB);
?>



Regards
Jams Lebron
Attune Infocom Inc
http://www.attuneinfocom.com
Email : contact@attuneinfocom.com
Magento Theme Design (http://www.magento-store-development.com/service/magento-design.html)

mtthwsmith8
06-04-2011, 05:19 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.

jamsl
06-06-2011, 08:32 AM
Thanks for share list of all the available parameters regarding getBaseUrl(). its good information provide us, once again thanks!


Regards
Jams Lebron
Attune Infocom Inc
http://www.attuneinfocom.com
Email : contact@attuneinfocom.com
Magento Theme Design

kevin207
06-06-2011, 08:42 AM
Hi mtthwsmith8,

Thanks to share Retrieving URL paths in Magento Function getBaseUrl() and its located under Mage class.