2

First, I was here but that doesn't help because

$this->getSkinUrl()

Is not what I want since it returns URL not path

Mage::getBaseDir('skin');

returns the skin base dir, they may be many themes there..

I want to determine the current theme base dir.

Community
  • 1
  • 1
ilyes kooli
  • 11,959
  • 14
  • 50
  • 79

3 Answers3

14

Try this:

Mage::getSingleton('core/design_package')->getSkinBaseDir()
Drew Hunter
  • 10,136
  • 2
  • 40
  • 49
-1

There may be many themes, but it will be using whatever you have configured and it will go all the way to the package/theme that might have been used in System > Config > Design

If you are looking for dir,

Mage_Core_Model_Design_Package::getSkinBaseDir()

public function getSkinBaseDir(array $params=array())
{
    $params['_type'] = 'skin';
    $this->updateParamDefaults($params);
    $baseDir = (empty($params['_relative']) ? Mage::getBaseDir('skin').DS : '').
        $params['_area'].DS.$params['_package'].DS.$params['_theme'];
    return $baseDir;
}

public function updateParamDefaults(array &$params)
{
    if ($this->getStore()) {
        $params['_store'] = $this->getStore();
    }
    if (empty($params['_area'])) {
        $params['_area'] = $this->getArea();
    }
    if (empty($params['_package'])) {
        $params['_package'] = $this->getPackageName();
    }
    if (empty($params['_theme'])) {
        $params['_theme'] = $this->getTheme( (isset($params['_type'])) ? $params['_type'] : '' );
    }
    if (empty($params['_default'])) {
        $params['_default'] = false;
    }
    return $this;
}
Vern Burton
  • 3,215
  • 1
  • 18
  • 31
-4

Here is how you can get the current them path

$_SERVER['DOCUMENT_ROOT'].parse_url($this->getSkinUrl(''),PHP_URL_PATH);

More details about parse_url

Mufaddal
  • 5,398
  • 7
  • 42
  • 57
ilyes kooli
  • 11,959
  • 14
  • 50
  • 79
  • 1
    @sonia - i'm not sure why this answer has been accepted. I would try and avoid code like this where possible from within a framework such as Magento – Drew Hunter Jun 11 '12 at 22:16
  • Agreed. This is a very poor inside Magento as it would completely destroy the theme fallback. As you are only supposed to to move editted files into your package/theme, and let the system fallback into base/default for everything else. – Vern Burton Jun 12 '12 at 00:56