I'm trying to load a component custom css file, placed in the frontend media folder in the media/mycomponent/css folder, to load into the backend after the backend template.css file (Isis) is loaded (in the head tag of every page). Is this possible? I've tried some options but so far no success.

  • Expand your answer to show what you have tried.
    – RichardB
    May 10 '17 at 14:50
  • Please include your comment content also in question so everyone will see what exactly you want to archive. May 13 '17 at 20:19

In the view of your component just add the CSS declaration as you normally would on the front end. Should work with no issues.

JFactory::getDocument()->addStyleSheet(JPATH_SITE . '/media/mycomponent/css/STYLE.css');

This should pull from the front end. You may be able to substitue JPATH_ROOT as well.

  • Thanks for reply, this works indeed in a view of a component. But in my case it is not the solution. I should be more specific what I want: in the options view of the config component (url: ../administrator/index.php?option=com_config&view=component&component=com_mycomponent), I want to load a specific lay-out. Would this be possible from within the component without 'hacking' the core of Joomla?
    – Franky
    May 11 '17 at 3:56

If you want to add a a custom html into component configuration popup you would have to create your own field type. That way you can manage the layout but still keep your component inside a framework flow and your configuration will be saved. All the custom stylesheets and scripts can be included same as in view templates.

Tutorial on creating custom form field.


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.