News:

Wondering if this will always be free?  See why free is better.

Main Menu

smf 2.1 index css url problem

Started by gecitli, August 15, 2018, 01:58:52 PM

Previous topic - Next topic

gecitli

Hello there

I can not add css to the link
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

Gwenwyfar

What exactly are you trying to do? I'm not sure I understand.
"It is impossible to communicate with one that does not wish to communicate"

gecitli

link structure does not work like smf 2.0?

smf 2.0

// The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />';


smf 2.1 also gives an error

echo '<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/fontawesome-all.css" />';
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

SychO

I'm not familiar with how 2.1 works, but what error does it give exactly ?
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

gecitli

#4
does not see bootstrap.css fontawesome-all.css

I can add one like this

loadCSSFile('fontawesome-all.css');
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

Arantor

Using that function is the correct way to do it in 2.1.

gecitli

The solution to the problem is to add code to index.css ie

@import url(https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css);
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

SychO

Why don't you just use the loadCSSFile function ?
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Kindred

Quote from: gecitli on August 16, 2018, 01:52:23 AM
The solution to the problem is to add code to index.css ie

@import url(https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css);

that's not the solution. That's an improper hack to the code that ignores the function which was created specifically for the purpose of including additional CSS files.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

gecitli

Quote from: Kindred on August 16, 2018, 09:48:05 AM
Quote from: gecitli on August 16, 2018, 01:52:23 AM
The solution to the problem is to add code to index.css ie

@import url(https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css);

that's not the solution. That's an improper hack to the code that ignores the function which was created specifically for the purpose of including additional CSS files.

okay but what's the solution

loadCSSFile('fontawesome-all.css');
loadCSSFile('bootstrap.css');


Someone is not working like this

Theme is here
https://github.com/gecitli/ozel

have a look

Demo

http://webtiryaki.com/forum/index.php
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

SychO

I don't think that's where it goes, put it in the <head> tag after
// load in any css from mods or themes so they can overwrite if wanted
template_css();

Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

gecitli

not to add the problem code, but the recognition is active while the other is passive.
http://www.webtiryaki.com
webmaster forumu
Free & Premium Responsive Themes for SMF.

Arantor

Where did you put the loadCSSfile call?

SychO

Quote from: Arantor on August 16, 2018, 11:58:32 AM
Where did you put the loadCSSfile call?

he put it in template_init()

function template_init()
{
global $settings, $txt;

loadCSSFile('fontawesome-all.css');
/* $context, $options and $txt may be available for use, but may not be fully populated yet. */
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Arantor

Correct place. I wonder if it needs more parameters.

Though honestly I long since forgot how to do this part since my own themes don't use any of this stuff.

Gwenwyfar

Quote from: Arantor on August 16, 2018, 12:50:21 PM
Correct place. I wonder if it needs more parameters.

Though honestly I long since forgot how to do this part since my own themes don't use any of this stuff.
Does it actually make any difference to use there vs above the template_css call?

There are others that were added recently to reorder the css, options to minify and something else I forgot. I believe they're optional though.
"It is impossible to communicate with one that does not wish to communicate"

Arantor

Potentially, yes, given that you need to do it early enough to actually make it into the template_css() call in the first place.

Advertisement: