News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Add custom css file to content plugin

Started by HerKle, 17.02.2021 22:10:58

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HerKle

Hi,

the plugin does not use the jdownloads_custom.css file so that its code has to be duplicated either into a new own file only for the plugin or integrated into joomla template user css. Duplication could be avoided if you integrate the custom.css file into the plugin itself.

At line 139 of plugins/content/jdownloads/jdownloads.php should be added
$custom_css_path = JPATH_ROOT.'/components/com_jdownloads/assets/css/jdownloads_custom.css';
if (JFile::exists('$custom_css_path')) {
$document->addStyleSheet(JURI::base().'components/com_jdownloads/assets/css/jdownloads_custom.css', "text/css", null, array());
}

I did it and it worked – but it might be lost by a future update of jD component. So I copied that file into a backup file to be able to reintegrate my changes into a new version of that file.
Kind regards, Herbert
  •  

ColinM

HiThanks
Sounds a usefull addition and will review for a future updateColin
Colin M
  •  

HerKle

Hi Colin,
I am missing the Thank-you-button in this forum layout – so I thank you here and thumbs up!
Kind regards, Herbert
  •  

ColinM

Herbert
Which version of jD are you using?
I checked out the code (as we are getting jD3.9.8 ready) and around line 161 the Content plugin loads the jD custom.css file  - this is in jD3.9.7.2
Could you check.  It only gets loaded if the page has jD content such as the content plugin or a module or similar
Colin
Colin M
  •  

HerKle

Hi Colin,
I didn't expect it to come that late, because in line 139 the decision between default and own css is taken. If I used own.css file, it would then be overwrtten again by custom.css. To me that feels not sound. That's why i put custom.css together with default before the else option of own css. And yes, I use jd 3.9.7.2, too.

So I would change my suggestion to move line 161-164 to line 139.

:)
Kind regards, Herbert
  •  

ColinM

HiWhat it means is that you can have both but the custom css would be the last one loaded so it would fulfill its primary objective function of selectively overriding specific parts of css files loaded earlier.  Own CSS might be from some other extension develpoer or template provider.
Best wishesColin
Colin M
  •