t.c
t.c

Reputation: 1257

get the frontend theme path in magento admin

In my Magento module i upload a CSS file in the backend to use it in my front

I tried this :

 Mage::getSingleton('core/design_package')->getSkinBaseDir()

But it gives different path (admin/front)

In my Block , I got this :

C:\wamp\www\ce_1.6.2.0\skin\frontend\default\default\

And in my Adminhtml/Controller (saving the file) I got this :

C:\wamp\www\ce_1.6.2.0\skin\adminhtml\default\default

How can I get the same path (front) in the Block and in the Controller ?
Thanks

Upvotes: 3

Views: 2644

Answers (3)

Charvi
Charvi

Reputation: 171

You can try this:

Mage::getSingleton('core/design_package')->getSkinBaseDir(array('_area' => 'frontend','_package'=>'rwd','_theme'=>'default'));

Upvotes: 0

Chris Rogers
Chris Rogers

Reputation: 1522

I'd like to offer and alternative to Rastaking's answer that will return a URL path rather than a file path:

Mage::getModel('core/design_package')->getSkinUrl();

This will return something like:

http://www.yourdomain.com/skin/frontend/your_package/your_skin/

Hope this helps, anyone looking for a similar solution.

Upvotes: 0

t.c
t.c

Reputation: 1257

just force it to the frontend :

Mage::getSingleton('core/design_package')->getSkinBaseDir(array('_area' => 'frontend'))

Upvotes: 7

Related Questions