When we design and develop Magento theme template, there is a function to know, that is the Getbaseurl function, with the Getbaseurl function we can call JS, image, file. in. phtml 1,getbaseurl Basic parameter call path echo Mage::getbaseurl (mage_core_model_store::url_type_web); Echo Mage::getbaseurl (Mage_ CORE_MODEL_STORE::URL_TYPE_JS); Echo Mage::getbaseurl (Mage_core_model_store::url_type_link); Echo Mage::getBaseUrl (Mage_core_model_store::url_type_media); Echo Mage::getbaseurl (Mage_core_model_store::url_type_skin); The above example parameters are longer, we can simplify the following parameter 2, refer to the Mage_core_model_store class to simplify Getbaseurl parameters Let's look at the Mage_core_model_store class first, open. App/code/core/mage/core/model/store.php class Mage_core_model_store extends mage_core_model_abstract{ .... /** * Possible URL types */ Const Url_type_lin K = ' link '; const Url_type_direct_link = ' direct_link '; const url_type_web   = ' web '; const Url_type_skin &NBS P ' skin '; const URL_TYPE_JS &NBS P = ' JS '; const Url_type_media = ' MEDIA '; & nbsp ....} According to the above class, we can use the simplified code to implement the path call echo mage::getbaseurl (' skin '); Echo mage::getbaseurl (' media '); Echo Mage:: Getbaseurl (' JS '); 3,mage_core_helper_url class call Path mage_core_helper_url class in./app/code/core/mage/core/helper /url.php file We can call the following functions //get home echo mage::helper (' Core/url ')->gethomeurl ();//Returns the path to the current page echo The Mage::helper (' Core/url ')->getcurrenturl () 4,geturl function can also call the path directly for example://Display the login path echo $this->geturl (' Customer /account/login '); also have a way to display pictures: echo $this->getskinurl (' images/qty.gif ');
Magento Path function Getbaseurl use method