Blog

Magento: get skin url, get media url, get base url, get store url


Magento: get skin url, get media url, get base url, get store url

Kita biasanya memerlukan gambar, javascript dll untuk Magento Mage Core, Static Blocks, CMS Page atau Phtml file. Berikut cara pemanggilannya di Magento.

Mengambil URL di Static Block/CMS Page

To get SKIN URL

 {{skin url='images/sampleimage.jpg '}}

To get Media URL

 {{media url='/sampleimage.jpg'}}

To get Store URL

 {{store url='mypage.html'}}

To get Base URL

 {{base url='yourstore/mypage.html'}}

Mengambil URL di PHTML

Not secure Skin URL

<?php echo $this->getSkinUrl('images/sampleimage.jpg') ?>

Secure Skin URL

<?php echo $this->getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?>

Get Current URL

<?php echo $current_url = Mage::helper('core/url')->getCurrentUrl(); ?>

Get Home URL

<?php echo $home_url = Mage::helper('core/url')->getHomeUrl(); ?>

Get Magento Media URL

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); ?>

Get Magento Media URL

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>

Get Magento Skin URL

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>

Get Magento Store URL

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>

Get Magento Js URL

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>

Semoga membantu 😀