[solved] FC 1.5.x (r889) mod_flexi load css [EXPLAINED]

More
12 years 7 months ago - 12 years 7 months ago #18804 by Rehne
Hi,

i do not know whether it is a bug
but somehow
i think something does not fit

if i use the news template for the FlexiMod
it is necessary that the css file is loaded ... always
this does not happen when the Joomla cache is not enabled ... as in the code is written
Code:
// Only when caching is active !!! if ($add_ccs && $caching && !${$layout}) { if (file_exists(dirname(__FILE__).DS.$layout.DS.$layout.'.css')) { // active layout css echo '<link rel="stylesheet" href="'.JURI::base(true).'/modules/mod_flexicontent/tmpl/'.$layout.'/'.$layout.'.css">'; } ${$layout} = 1; }

but I do not use the Joomla cache, because FC brings his own

also in the FC version 1.5.5 the css file was loaded even the Joomla cache was not activated

what is the intent?
i think the css file is always needed

Regards
Last edit: 12 years 7 months ago by Rehne.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18809 by ggppdk
Did not test but i can guess from other similatr occasions, why this conditional statement is there.

There is a statement
$document->addStyleSheet(...) inside the file mod_flexicontent.php that loads the CSS file of the current "Flexicontent Module" template.

I am guessing that this statement is not executed when cache is on.

That is why theses conditional statements (in tmpl/news.php) and (in tmpl/select.php) are needed ...


Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18811 by Rehne
Hi

i understand that not all...

my tests shows, that the css files will be loaded if the Joomla cache is enabled but not when the Joomla cache is disabled

means that the Joomla cache must be enabled?

in the FC version 1.5.5 it worked well without Joomla cache

:?:

Regards

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18818 by ggppdk
I will try to explain what is happening:

This is not a bug of flexicontent module
-- Actually it tries to work around the problematic design of joomla caching mechanism combined with $document->addStyleSheet(...) in modules.

-- THE PROBLEM SEEMS to be that joomla caches the page on component completion or some other point BEFORE the module code is executed -- AS a result the cache contains NOT THE FINAL HTML CODE of the page. We work around problem by inserting the css file link statement inside the html of the module
. Please read on:

1. The proper place to insert the css file is between the HTML tag <head></head>, this is done by the call

$document->addStyleSheet(...) inside the file
/modules/mod_flexicontent/mod_flexicontent.php
that loads the CSS file of the current "Flexicontent Module" template.

BUT THIS code is not executed when caching is enabled. THIS COMBINED with the fact that the cached page was cached at a wrong point and thus doesnot contain the html code to load the css file creates the problem

By putting this extra code inside the files
/modules/mod_flexicontent/tmpl/news.php and
/modules/mod_flexicontent/tmpl/select.php

we bypass the problem by inserting the css file inside the html of the module which is the cached BUT IT INCLUDES the loading of the css file

If you have a cleaner solution please suggest.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18878 by Rehne
hallo ggppdk,

thank you for your explanation
i understand that now even better
but I must nevertheless ask again :?

if I have understood correctly (and i think so ;) )
if the Joomla cache is disable
the css files will be loaded by the statement in the
mod_flexicontent.php ... right?
you say it ...

ggppdk wrote: $document->addStyleSheet(...) inside the file
/modules/mod_flexicontent/mod_flexicontent.php
that loads the CSS file of the current "Flexicontent Module" template.

... and the mod_flexicloud works this way also
and it does it right ... as you have described it
joomla cache disable ... css file is between the HTML tag <head></head>
joomla cache enable ... css file is inside the html of the module

but the mod_flexicontent does not load the css file between the HTML tag <head></head> if the joomla cache is disabled ... it is not loaded anywhere
only ... in the FC version 1.5.5 it worked well

only if the joomla cache enabled the css will be loaded ... inside the html of the module

you understand my problem :roll:

Regards

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18879 by ggppdk
in mod_flexicontent.php there 3 variable in the if:
Code:
if ($add_ccs && !$caching && !${$layout}) { ... }

before the if do echo statements to check the variables:
echo "add_ccs: $add_ccs<br>";
echo "caching : $caching <br>";
echo "layout: $layout<br>";

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.284 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline