2

I am looking to apply a stylesheet located in the skin/frontend/default/mytheme/css folder to a page inside the admin area of Magento. See the layout XML I am using to add this stylesheet to the admin page below:

<my_custom_admin_layout_handle>
        <reference name="head">
            <action method="addItem">
                 <type>skin_css</type>
                 <file>css/my-custom-stylesheet.css</file>
            </action>
        </reference>
</my_custom_admin_layout_handle>

The code does add the stylesheet link tag to the page but references the href as skin/adminhtml/base/default/css/my-custom-stylesheet.css. See link tag added to page below:

<link rel="stylesheet" type="text/css" href="/skin/adminhtml/base/default/css/personalshop.css" media="all" />

Is there a way that I can get the stylesheet href to reference the stylesheet in the folder skin/frontend/default/mytheme/css using the layout handle above?

2

you need put the css admin area.

Admin css located at skin/adminhtml/<AdminPackage>/<Admintemplate>.

my-custom-stylesheet.css should located at skin/adminhtml/default/default/css

code is right:

<my_custom_admin_layout_handle>
        <reference name="head">
            <action method="addItem">
                 <type>skin_css</type>
                 <file>css/my-custom-stylesheet.css</file>
            </action>
        </reference>
</my_custom_admin_layout_handle>
  • Hi Amit, This would mean duplicating code though and the styles contained inside the file will be shared on both frontend and admin pages. I want this to remain the same without the need to update the code in 2 places if there are updates to the stylesheet in the future. – Ryan Copeland Mar 24 '15 at 11:53
  • according my concept .it too complex – Amit Bera Mar 24 '15 at 12:00
  • thanks for your response. Are you saying that it can't be done? – Ryan Copeland Mar 24 '15 at 12:37
  • possible.but it loo complex to do this type.. wasted of time.. I totally my thought – Amit Bera Mar 24 '15 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.