e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
318 stars 212 forks source link

[Bug]: Bootstrap 5 and Fontawesome 6 doesn't load in theme #5275

Open rica-carv opened 1 week ago

rica-carv commented 1 week ago

What e107 version are you using?

v2.3.3

Bug description

I'm trying to use BS5 and FA6 on a theme, with these code:

define("BOOTSTRAP", 5);
define("FONTAWESOME", 6);
e107::library('load', 'bootstrap');
e107::library('load', 'fontawesome');`

But when theme loads, icons and some text are not shown or bad rendered, and the bootsrtap libary that is loaded is BS3 and FA4....

What i'm doing wrong here?

How to reproduce

use


define("BOOTSTRAP", 5);
define("FONTAWESOME", 6);
e107::library('load', 'bootstrap');
e107::library('load', 'fontawesome');

inside theme.php, and use fa icons on the HTML

Expected behavior

I expected to render as usual, with BS3 and FA4

What browser(s) are you seeing the problem on?

Firefox

PHP Version

7.4

rica-carv commented 1 week ago

Well, ended up forcing it on the theme code, for now... So now i have a theme with bootstrap 3 & 5 loaded and fontawesome 4 & 6 loaded.... What a mess... :grin: :sweat_smile:

Jimmi08 commented 1 week ago

Because I don't know how (where) you are using those constants, you could look at a new way to load libraries via theme.xml

https://github.com/e107inc/e107/issues/4832

I am not saying that this works correctly (I have some issues with this topic too), but standard loading of libraries should be working.

rica-carv commented 1 week ago

@Jimmi08 If you're talking about this:

          define("BOOTSTRAP", 5);
          define("FONTAWESOME", 6);
          e107::library('load', 'bootstrap');
          e107::library('load', 'fontawesome');

it also doesn't work. I even upgraded the theme to v2.3 standards (ie: with layouts and templates mixed....), but no go.

So i ended up loading them like this, the hard way:

          e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css');
          e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/fontawesome.min.css');
          e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.min.js", 'jquery', 2);
Jimmi08 commented 1 week ago

@rica-carv no, I am talking about theme.xml and library definition there. This shouldn't be used anymore:

          define("BOOTSTRAP", 5);
          define("FONTAWESOME", 6);
          e107::library('load', 'bootstrap');
          e107::library('load', 'fontawesome');
rica-carv commented 4 days ago

@rica-carv no, I am talking about theme.xml and library definition there. This shouldn't be used anymore:

          define("BOOTSTRAP", 5);
          define("FONTAWESOME", 6);
          e107::library('load', 'bootstrap');
          e107::library('load', 'fontawesome');

@Jimmi08 Indeed, i learned the hard way you shouldn't mix both things. For note, event this code only loads BS3, not 5....

So i aknowledge thath the xml way works, but only after a long strugle. Even without cache on, it keep creating cache, so i deleted it several times, no go. So i had to change theme severeal ways, with cache deleting by the midle, and finally it worked! It's weird to not have the xml read every time it's changed. It is only read at theme instalation, so it was a hard time. It should be a developer mode for preventing these issues....

Anyway, thanks for the help....

Jimmi08 commented 4 days ago

@rica-carv I reported this many times. Or complained about this. The best way is to delete the cache folder manually. Yeah, I learned that hard way too. You will find that it is always cached (regardless your settings) and it always reads from cached file.

And be sure you have hash tag in your config file - new installations have it. And wait until your preferences will start to behave weird way. Long story.

rica-carv commented 3 days ago

Reopening, after all fontawesome 6 is not loaded, only bootstrap 5....

Furthermore, all icons are rendered as SVG tag's, not fa- classes tags.....