Get skin path in Magento?

magento, templates

Solution

The way that Magento themes handle actual url's is as such (in view partials - phtml files):

`echo $this->getSkinUrl('images/logo.png');`

If you need the actual base path on disk to the image directory use:

`echo Mage::getBaseDir('skin');`

Some more base directory types are available in this great blog post:

http://alanstorm.com/magento_base_directories

Problem

I have a few custom PHP functions for my Magento store that I stored in myfunc.php and I need to require it from in a few different .phtml files. How do I do that? I mean I can use an absolute path but that would be dirty and probably problematic when migrating to another server. For now I'm stuck with: ``` require('/home/myuser/public_html/app/design/frontend/default/mytheme/myfunc.php'); ``` How do I refer to the skin path ( /home/myuser/public_html/app/design/frontend/default/mytheme/ ) programmatically?

Original source