Core Magento uses this in core code:
Mage::getDesign()->getSkinUrl('images/image.gif');
Which calls:
public static function getDesign()
{
return self::getSingleton('core/design_package');
}
They are both equivalent except that $this
may not work in all contexts/cases so I would recommend using Mage::getDesign()
to avoid having issues.
PHP 5.3 has some issues using $this
in some contexts.
You should be able to use Mage::getSingleton('core/design_package');
consistently as well.
Magento identifies which 'area' you're calling getDesign from so...
To evoke adminhtml or frontend areas and get their skin urls use:
$oDesign = Mage::getDesign()->setArea( 'adminhtml' );
$oDesign = Mage::getDesign()->setArea( 'frontend' );
var_dump( $oDesign );
$sUrl = $oDesign->getSkinUrl('images/image.gif');
var_dump( $sUrl );