WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 11.04.2018 20:41:41

digitalbricks
Mitglied

MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

Hello Community,

i recently experienced an issue with modules (also) made for WB, such as – but not only – MPForm:

Some modules prints the contents of their frontend.css directly into the HTML output, causing CSS styles of the template to be "overwritten". This happens unless the module frontend.css is already included via register_frontend_modfiles().

This issue arises because the check for the constant MOD_FRONTEND_CSS_REGISTERED fails in the view.php of the module. Here an example from MPForm 1.3.20:

[== PHP ==]
// check if frontend.css file needs to be included into the <body></body> of view.php
if((!function_exists('register_frontend_modfiles')
    || !defined('MOD_FRONTEND_CSS_REGISTERED'))
    && file_exists(WB_PATH .'/modules/mpform/frontend.css')) {
        echo '<style type="text/css">';
        include_once(WB_PATH .'/modules/mpform/frontend.css');
        echo "\n</style>\n";
}

As it seems, this constant MOD_FRONTEND_CSS_REGISTERED is present on WB installations after calling register_frontend_modfiles() but is NOT on WBCE. I did a folder search in a new WBCE installation for that string "MOD_FRONTEND_CSS_REGISTERED" but didn't found it in a define() somewhere in the core of WBCE – only in some view.php of some modules (e.g. topics, mpform, members).

Curiously I didn't stumble over that issue on former WBCE projects. So either i just didn't noticed it before, the constant was present in former versions of WBCE or i am just doing something wrong (what i would not exclude totally).

Just for the record: I solved that problem by defining that constant in the template manually – directly after the register_frontend_modfiles() call.

Kind regards
André

Offline

#2 11.04.2018 20:47:03

florian
Administrator

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

Offline

#3 11.04.2018 21:02:18

digitalbricks
Mitglied

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

Wow, florian – are you always connected to this forum?
At least concerning my posts, you are always the first responder.  wink

Sooo ... as I understand in the post you linked, it's a known issue?
But it seems this could only be fixed by
– changing the module code by the module author (which will not happen in most cases, i am afraid of)
– setting the constant MOD_FRONTEND_CSS_REGISTERED manually (in order to get WB modules to not double-load the CSS)

Why was this constant removed? I am sure there is a valid reason for it, but i don't see one at the moment.

BTW: Of course I did a forum search for MOD_FRONTEND_CSS_REGISTERED before writing my post but didn't found a post addressing this issue because i didn't check ALL of these dozen checkboxes in the "Wähle, wo gesucht werden soll" input. Is there a way to say "Search in all"?

Offline

#4 11.04.2018 21:48:39

colinax
Developer

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

Hi, the error occurs because we decided to remove the old Include routine from WebsiteBaker 2.6 or earlier, for a simple cleanup.

We will take care of this problem.

I know the problems with the search function, which is not really smart.

LG Christoph

Edit : grammar corrected

Beitrag geändert von colinax (12.04.2018 08:33:20)

Offline

#5 12.04.2018 07:22:21

florian
Administrator

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

@digitalbricks
I'm subscribed to each topic and each forum, so I get an e-mail notification each time someone posts somethiing.
Being the one who answers is my job, but I 'm happy if other community members try to help too ofcourse.

The search enginge of this forum software behaves a bit strange. It's often better to use google with the url:forum.wbce.org parameter. By the way, you certainly do not have to check each forum, as if no forum is checked, all forums will be searched.

@colinax
As a quick fiox for the issue, maybe it's enough to set MOD_FRONTEND_CSS_REGISTERED in the config.php for bachwards compatibility?

Offline

#6 12.04.2018 08:35:43

colinax
Developer

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

florian schrieb:

@colinax
As a quick fix for the issue, maybe it's enough to set MOD_FRONTEND_CSS_REGISTERED in the config.php for bachwards compatibility?

I don't know. This is a question  e.g. for Norhei, rjgamer, blackbird and so on.

Offline

#7 12.04.2018 19:32:17

digitalbricks
Mitglied

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

Just a proposal:
If there is other legacy stuff you want to get rid off – aside the  MOD_FRONTEND_CSS_REGISTERED – you could establish a "legacy mode" which could be enabled by a setting in the config.php and wich, if enabled, loads a file with all the old dependencies required for running WB modules. So you could have a clean base for new modules and an encapsulated support for old ones.

Offline

#8 03.05.2018 21:01:40

mrbaseman
Core-Team

Re: MOD_FRONTEND_CSS_REGISTERED und Interoperabilität mit WB-Modulen

I have just noticed that I forgot to post here that the issue was fixed in mpform 1.3.22. I have seen that similar code existed in several modules. I'm not sure if it has been fixed in these places, too. Sorry, this has fallen through the cracks on my side after I had published the mpform fix.

Offline

Liked by:

colinax, florian

Fußzeile des Forums

up