Magento: Get the skin url

When editing Magento tempates or CMS pages you will have a need to access images and other content inside the skin/—/images folder. Instead of making hard coded links in the CMS or templates a better way is to get this from Magento (one of the many reasons for doing this is that it will still work if something in the directory structure is changed – like say you dev server is dev.something/shopverige but the live store is directly on a domain like say http://www.shopsverige.se

Here is how to do it:

<!-- this is inside of .phtml files -->
<img src="<?php echo $this->getSkinUrl('images/coolimage.png'); ?>" alt="arrow"/>
 
<!-- use this is in cms block -->
<img src="{{skin url='images/coolerimage.png'}}" alt="" />