Erick Boileau
Erick Boileau

Reputation: 494

Joomla cannot unset mod_languages/css/template.css

Joomla 3.x The following code is not working

unset($doc->_styleSheets[JURI::root(true).'/media/mod_languages/css/template.css']);

thank you

Upvotes: 0

Views: 248

Answers (2)

David Taiaroa
David Taiaroa

Reputation: 25485

A variation which I've used with success in the past:

unset($doc->_styleSheets[$this->baseurl.'/media/mod_languages/css/template.css']);  

Update

Here's an alternate method using a module override which should work for you.

  • if it doesn't already exist, create a new directory titled html in your template's folder, ie: /templates/your-template/html/
  • inside this, create an new mod_languages folder, ie /templates/your-template/html/mod_languages/
  • copy the file from joomla-site-root/modules/mod_languages/tmp/default.php to the folder above, ie /templates/your-template/html/mod_languages/default.php
  • open this file with a text editor and around line 12 look for the line where JHtml is loading the mod_languages CSS, and comment it out.

    // JHtml::_('stylesheet', 'mod_languages/template.css', array(), true);

That's it, hopefully, this will do the trick for you.

Overriding Joomla core output using this method is safe and you won't loose your work with future Joomla updates.

More info about Joomla overrides:
https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core

Good luck!

Upvotes: 0

Riccardo Zorn
Riccardo Zorn

Reputation: 5615

The code is correct and I tested it, it's working fine. Possibly you are running it in a plugin event after the head is rendered, or you have cached the page and the code is not really running.

In either case, try to put it at the component level, clear cache, and it should work


Update

to identify the component: turn SEF off, and look at the URL it shows as option=com_componentname; to identify the module, simply rename the modules folder, and update the site; if it works, it's a module. For plugins, rename the plugins/system and plugins/content first, then drill down until you spot it. Alternatively, but much slower, you can turn modules and plugins on and off from the backend, until you find the culprit.

Upvotes: 1

Related Questions