1
Burning
Xoops cache and stylesheets :-(
  • 2009/11/1 22:21

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi

I have noticed a matter with XOOPS cache modules (set in Preferences).

When I set cache for a module, css stylesheet is not compiled in these two case :
• if stylesheet is embadded (eg: weblinks, MadLiens have their own stylesheet but forgotten by cache)
• if styleshhet is overrided (instruction : <{$xoTheme->addStylesheet('modules/module-name/overrided-stylesheet.css')}>)

... is someone could test it ? I can just see problem but I'm not able to explain it

To resolve it, I have to
• erase embadded stylesheets
• not use overriding
• and put all my css instructions in a new stylesheet, called by theme.html, with this instruction : @import url(my-stylesheet-for-modules.css)


I hope you understand what I've wrote



nb : I use XOOPS 2.4

2
ghia
Re: Xoops cache and stylesheets :-(
  • 2009/11/2 2:04

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I could simulate this problem.
When the cache is switched on, no problem.
When the module style file is edited (eg change of colour of a title) and saved, in the next access (browser refresh) the file is no longer listed in the meta of the HTML head and the module styles are no longer applied.
When the cache time (eg 5 min) is over, the cache regenerates and the module.css is again in the head and the change is visible.

3
ghia
Re: Xoops cache and stylesheets :-(
  • 2009/11/2 9:29

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Wrong conclusion by not doing enough reloads in the browser (FF 3.5.4). Editing the CSS file has nothing to do with it.
In the template there is a line to add the style file for the module, located in /module/ghost/css
<{$xoTheme->addStylesheet('modules/ghost/css/modules.css')}>

This gives an additional meta in the HTML head.
When cache is put on for the module, first time the page displays normal. Subsequents reloads in the browser have the module CSS file not loaded (absent meta in the head) and the page layout is consequently different, because the not applied module CSS.
When the cache time expires, the reload gives a correct page. Subsequent reloads during the cache time give again the missing CSS.

4
ghia
Re: Xoops cache and stylesheets :-(
  • 2009/11/2 9:34

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Not a 2.4.0 related problem. It is in 2.3.3 also.

5
playsome
Re: Xoops cache and stylesheets :-(
  • 2011/7/31 0:00

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


I realise this is an old topic im bumping, but I have found this same or similar problem in xoops 2.4.5 witha few modules so I dont think its a module problem but a xoops one.

On some modules when cache is set via preferences the css file for that module does not load and all styling is lost, if i take the cache off and refresh the css file loads properly.

Has there been any fix for this, other than adding the module css file in the head of the theme or using, as above, the @import in the main theme style.css?

Cheers

6
Mamba
Re: Xoops cache and stylesheets :-(
  • 2011/7/31 0:40

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


I am not aware of any fixes. I reported it as a bug in our Bug Tracker
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

7
efutures
Re: Xoops cache and stylesheets :-(
  • 2011/8/18 13:26

  • efutures

  • Just popping in

  • Posts: 1

  • Since: 2011/8/18


ETA on the fix for this one Mamba? I thought you might have a bit of an inside track on this one. Thanks for your help!

"Whenever you find yourself on the side of the majority, it is time to pause and reflect." managed futures
~Mark Twain

8
playsome
Re: Xoops cache and stylesheets :-(
  • 2011/8/18 18:29

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


I would like to know an ETA on a fix for this issue as well, it still happens with xcgal even if only cached for 30 seconds.

It does not seem to happen with all modules only some so perhaps it is the way in which developers are inlcuding the css file in php code?

One solution is to use @import in the theme css file as mentioned above, another one is to search the modules files for the included css file, remove all reference to the external css files from the module code and include something like this in the main theme.html

<{if $xoops_dir == 'module_name'}>
<
link href="path/to/module/cssfile" type="text/css" rel="stylesheet" />
<{/if}>


Could a xoops developer provide the absolute definate way to include an external css file in a modules php code?

Cheers

9
Mamba
Re: Xoops cache and stylesheets :-(
  • 2011/8/18 20:26

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Both Trabis and ForMuss are on vacation this week. I assume it will be looked into this issue as part of fixing bugs in 2.5.2 release.

But let's wait for them to come back so they can give us some estimates.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

10
trabis
Re: Xoops cache and stylesheets :-(
  • 2011/8/24 12:41

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

playsome wrote:

Could a xoops developer provide the absolute definate way to include an external css file in a modules php code?


Well, only way I see is to use
$GLOBALS['xoopsOption']['xoops_module_header'] = '
just before calling header.php

Any php code after the inclusion of header will be ignored when cache is used.


The problem with this solution is that you need to hard code the string and that it will not account for duplicate file inclusion. If you're adding jquery, and then a block from other module also adds jquery(using $xoTheme) they will both be loaded causing a conflict.

Future solution is make $GLOBALS['xoopsOption']['xoops_module_header'] accept an array of values(not full formated string)and then use $xoTheme to format those values, check for duplicates and assigning them to theme.

For now, there is not a 100% solution.

Login

Who's Online

227 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 227


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits