- Học nghệ thuật đầu tư dựa trên giá trị.
- Kinh nghiệm đầu tư thành công.

Được tạo bởi Blogger.

Thứ Sáu, 22 tháng 8, 2014

Code - Các hàm lấy đường dẫn URL trong Magento trong file template .phtml


A. Các hàm get Url magento sử dụng trong file template .phtml

1. Get Base Url magento:
Mage::getBaseUrl();

2. Get Magento Skin Url magento:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

3. Get Media Url magento:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);

4. Get Js Url magento:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

5. Get Store Url magento:
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

6. Get Current Url magento:
Mage::helper('core/url')->getCurrentUrl();

7. Get Home Url magento :
Mage::helper('core/url')->getHomeUrl();

B. Các hàm Get Url magento trong CMS Pages hoặc Static Block:

1. Get Base Url magento :
{{store url=""}}

2. Get Skin Url magento:
{{skin url='images/imagename.jpg'}}

3. Get Media Url magento :
{{media url='/imagename.jpg'}}

4. Get Store Url magento :
{{store url='mypage.html'}}

0 nhận xét:

Đăng nhận xét