Best way to include header JS/CSS files in all pages above the body tag

Hi there,

I have the following structure:

<link rel="stylesheet" href="css/stylesheet-1.css">
<link rel="stylesheet" href="css//glyphicons.css">
<!-- css files etc -->
<?php include("inc/header.php"); ?>
<!-- rest of page etc -->

What I would like to do is to include all the CSS and any other files above the tag in an include file, but wondered what the best practice in doing this would be.

I can’t include them in my header file as this is inside my tag and I don’t want to include the tag in my header file.

Could I just add another include file above the called something like inc/styles.php ?

Is there a good naming convention for this or a good way of including items above the ?


As far as conventions, I’d say most people call the include that contains their <head> info header.php that I’ve seen. If you aren’t doing that… I’d do whatever you want. Call it styles or whatever makes sense for the content within it. And no, there’s nothing wrong with having the second include, do it however makes sense for your application!

Out of curiosity, why no include the tag? You don’t want to upset the syntax highlighting or something?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.