I'm looking for advice on how to include multiple CSS files into my PHP using only one <link> in the head of the document.
I've got it working for javascript, however CSS doesn't seem to want to work..
This is what I have in the head of my document
<script src="/min/general.js" type="text/javascript" charset="utf-8"></script> <link rel="stylesheet" href="/min/general.css" type="text/css" media="all" />
in my .htaccess file, I have a rule that checks for 'min/' at the start of the URL, and sets a get variable, f, accordingly:
RewriteRule ^min/(.+)$ index.php?f=$1 [QSA,L]
Now in index.php, I have an if statement that checks if 'f' is set, and then processes an ini file to get all CSS file listed in that ini.
if(isset($_GET['f'])){ $file = $_GET['f']; $ini = parse_ini_file("../min.ini", true); foreach($ini[$file] as $f){ //echo '<style type="text/css">'; include $f; //echo '</style>'; } }
So that will include all the files I need, whether that be js or CSS, however the CSS doesn't apply to the page.. If I put an alert(1) in my javascript, that will fire off perfectly, and if I click on view source, and click on the link to the css, then my CSS code will display in the browser (as if it were a text document), or if I un-comment the two echos in the foreach, it will actually apply the CSS.
So basically the files are being found perfectly, however the CSS isn't being applied to index.php.
Does anyone know what else I need to do?
P.S. Here is my ini file:
[general.css] website.css = "/css/style.css" [general.js] website.js = "/js/script.js"
Thanks in advance!
Denno