In this article we will see; in Magento how we can get Skin, Media and Other URLs in Static block and .phtml file.
In one of the earlier article we have seen 4 ways to get Magento Homepage URL. Now in this article we will see how to get Skin, Media URL in .phtml file and static block.
So Let’s start with the Static block first:
Get Media URL in Static Block – Magento
[cc lang=”html”]
{{media url=”}}
[/cc]
If you want to get something added after media URL then you just need to place below code instead.
[cc lang=”html”]
{{media url=’images/logo.jpg’}}
[/cc]
Get Skin URL in Static Block – Magento
[cc lang=”html”]
{{skin url=’images/sampleimage.jpg ‘}}
[/cc]
If you want to get something added after skin URL then you just need to place below code instead.
[cc lang=”html”]
{{skin url=’images/logo.jpg’}}
[/cc]
Get Homepage URL in Static Block – Magento
[cc lang=”html”]
{{config path=”web/unsecure/base_url”}}
{{config path=”web/secure/base_url”}}
[/cc]
Get Skin URL in .phtml File – Magento
[cc lang=”php”]
// Non Secure URL
echo $this->getSkinUrl(”);
// Secure URL
echo $this->getSkinUrl(”, array(‘_secure’=>true));
// If you want something added behind the URL
echo $this->getSkinUrl(‘image.jpg’);
[/cc]
Get Media URL in .phtml File – Magento
[cc lang=”php”]
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
[/cc]
Stay tuned with us on Twitter, Facebook and Email for more tips and tricks for magento.
helps a lot, thx…..
helps a lot, thx…..
Magnificent goods from you, man. I’ve be mindful your stuff prior to and you are just too great. I actually like what you have received here, certainly like what you’re saying and the way through which you assert it. You are making it enjoyable and you still take care of to stay it sensible. I can not wait to read much more from you. This is actually a terrific website.
Magnificent goods from you, man. I’ve be mindful your stuff prior to and you are just too great. I actually like what you have received here, certainly like what you’re saying and the way through which you assert it. You are making it enjoyable and you still take care of to stay it sensible. I can not wait to read much more from you. This is actually a terrific website.