By Martin on Saturday, 02 November 2013
Posted in General Issues
Replies 10
Likes 0
Views 1.2K
Votes 0
Hi!
I want to change the style of the modules, so i created a CSS override for modules.css in this path:
/templates/"mytemplatename"/html/com_easyblog/assets/css/module.css

The override is working "parcialy", as it does load this css override, although, it also load the original css, and as the original is loading last, the styles have priority over my css override.

Im placing the override on the right place? its a bug? why its loading both files?

Regards
Hello Martin,

I am really sorry for the delay of this reply as it is a weekend for us here. Most of the time, users would only want to override small portion of the codes, hence we still load the default css file to simplify the user's process of designing the page. If you really need your own styles, what you can do temporarily is to edit the file /components/com_easyblog/helpers/helper.php and at line 2562 locate the codes below and remove them,


$document->addStyleSheet( rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/css/' . $fileName );
·
Sunday, 03 November 2013 01:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Mark for your reply, even on saturday
The overrides are called that way because they override the default behaviour. Loading the original file is a bad practice for those who understand joomla overriding.
If you load both files (original + override) you should load the original first, and the override next. Otherwise the original replace the override, and makes no sense.
Modifying core files is not an option for me, as i would have to modify again everytime there is an update, and appart of being time consuming, its quite annoying.
I think the only option here would be to leave the override with only the modifications i need, and the "!important", so my styling make effect.
Is that right?

Regards!
·
Sunday, 03 November 2013 01:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Martin,

Yes, perhaps this should really be a setting and it should be disabled by default. We actually tried this on earlier versions but some customers do not want to go through the hassle of re-styling everything again.

Yep, that's right if you don't want to hack the helper.php file, use !important or if you dislike using important, use a more specific selector like prefixing it with body #id .class > element{}
·
Sunday, 03 November 2013 01:47
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks!
I will do what you advise me
Although i think being compliant with Joomla its important, as its the main framework, and developers are familiar with it.
Thanks again for taking care of your customers on weekend!
·
Sunday, 03 November 2013 01:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep, agreed and You are most welcome
·
Sunday, 03 November 2013 02:02
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark!
I was about to modify the CSS, leaving only the modifications on the override, but i realized that some parts will not take effect.
If the original file contains:
a:hover{ styles... }
And my modified CSS want to remove a:hover to inherit the styling, then there is no way to do it. As CSS cant remove styling, only add over previous ones.
This makes impossible CSS customizations, and the only way to do it looks to be the one you proposed on your first post, to completely remove the loading of the original file.
·
Sunday, 03 November 2013 21:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Removing the line from helper.php break the style of all easyblog, but module.css is still being loaded.
Module.css must be called from somewhere else.
·
Sunday, 03 November 2013 21:35
·
0 Likes
·
0 Votes
·
0 Comments
·
Hm, which file / line did you removed? I can't really tell the problem unless I take a look at the site.
·
Sunday, 03 November 2013 23:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark!
Ive modified helper.php to load only override instead of both.
The code is like this:
	public static function addTemplateCss( $fileName )
{
$document = JFactory::getDocument();

$mainframe = JFactory::getApplication();
$templatePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $fileName;

if( JFile::exists($templatePath) )
{
//load override file
$document->addStyleSheet( rtrim(JURI::root(), '/') . '/templates/' . $mainframe->getTemplate() . '/html/com_easyblog/assets/css/' . $fileName );
return true;
}
else
{
//load original file
$document->addStyleSheet( rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/css/' . $fileName );
return false;
}
}


Ill keep this for me, as i prefer this behaviour.
But this dont fix the problem.

I commented out this lines for testing:
2569: $document->addStyleSheet( rtrim(JURI::root(), '/') . '/templates/' . $mainframe->getTemplate() . '/html/com_easyblog/assets/css/' . $fileName );
2612: EasyBlogHelper::addTemplateCss( 'module.css' );
2716: $document->addStylesheet( $path );
2729: $document->addStylesheet( rtrim( JURI::root() , '/' ) . '/components/com_easyblog/themes/default/css/styles.css' );
2731: $document->addStylesheet( $path );

When all that lines are commented no css files for easyblog are loaded, EXCEPT FOR MODULE.CSS!!!
So i thought the modules should be loading the CSS by themselves. Ive disabled every EasyBlog module, and YES! module.css is not being loaded!
Im checking the modules....
...
...

Found the problem...
Categories module is loading modules.css this way:
$document->addStyleSheet( rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/css/module.css' );
But should be done this way:
EasyBlogHelper::loadModuleCss();

Aplause, aplause....
Yes, everything is working now...
·
Monday, 04 November 2013 19:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah, the categories module needs to go through some updating. Will check on this and thanks for the heads up on this
·
Monday, 04 November 2013 19:37
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post