News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

link stylesheet or php include for CSS files?

Started by rcane, March 08, 2023, 09:07:40 AM

Previous topic - Next topic

rcane

I'm building a file 'template.css' that is just full of CSS styles.

As a test, I made a simple index.php that had 'include_once("template.css"); which worked fine.

But, what is the preferred convention?

Should I be using <link> with the stylesheet and appropriate href /> instead?

Diego Andrés

Yo should be using <link> either inside the <head> tag in the index.template.php or appending it to $context['html_headers']

For SMF 2.1, you should be using the loadCSSFile() function

SMF Tricks - Free & Premium Responsive Themes for SMF.

rcane

Thanks.  These are custom pages that I'm keeping in a single folder so I'm not needing to get involved with $context.  I'll just keep and link my own CSS for these pages.



Arantor

But if you're using SSI to load the theme, you will *have* to use $context for this kind of integration...

Advertisement: