Current Skin Url
I want to get skin URL of my current theme. At present I am working in Magento "rwd" theme.
And I am using below code to get skin URL:
Mage::getDesign()->getSkinUrl();
This returns me URL http://localhost/magento/skin/frontend/default/default/
but I need URL like: http://localhost/magento/skin/frontend/rwd/default/
Please help me.
Solutions
You can easily avail the current URL of your existing Magento theme by using the below-mentioned code:
<?php echo $this->getSkinUrl();?>
I have used following command to get different URL in magento Get Url in phtml files
1. Get Base Url :
Mage::getBaseUrl();
2. Get Skin Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
(a) Unsecure Skin Url :
$this->getSkinUrl('images/imagename.jpg');
(b) Secure Skin Url :
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
3. Get Media Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
4. Get Js Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
5. Get Store Url :
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
6. Get Current Url
Mage::helper('core/url')->getCurrentUrl();
Get Url in cms pages or static blocks
1. Get Base Url :
{{store url=""}}
2. Get Skin Url :
{{skin url='images/imagename.jpg'}}
3. Get Media Url :
{{media url='/imagename.jpg'}}
4. Get Store Url :
{{store url='mypage.html'}}
I think this will help you.
When you are using
Mage::getDesign()->getSkinUrl($file = null, array $params = array());
You should pass in the $file
parameter for the resource you are trying to retrieve; e.g.:
Mage::getDesign()->getSkinUrl('images/example.png');
Magento will automatically search in your site's set theme first and if it's not there it will continue its search using the theme fallback.