Magento Path function Getbaseurl use method

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.