2

I am stumped. I am using includes to import a style sheet. If I add a new style to the style sheet, generated pages will not display ANY of the new css. If I change an old css rule it WILL display the change. I thought it might be a cached file of some kind, but I have cleared the cache in all testing browsers and the problem persists.

At first I thought it was a WAMP issue, but the problem happens when I move it all live as well so now I am thinking I am doing something wrong with the includes....

<link rel="stylesheet" type="text/css" href="css/foundation.css">
<!-- Included Custom Overides -->
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
<!-- Supersizer CSS -->

And this is simply my include...

<?php require("Includes/HEADER.php"); ?>

Again, all the old CSS works fine, just any new additions to any of the style sheets will not display.

Thanks

  • Sounds like a browser cache issue, are you sure your browser cache is cleared when viewing the changes? – Chase Oct 23 '13 at 21:43

2 Answers2

0

Sounds like a browser cache issue. A simple way to fix this while maintaining good caching practices would be to pass the file make time as a query var to the file.

<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=<?php echo filemtime('css/foundation.css');?>">

This will generate a string like:

<link rel="stylesheet" type="text/css" href="css/foundation.css?ver=1382564850">

This way when you update the file your browser will think its a new file and cache that, but as long as the file remains unchanged it will have the same name and maintain the browser cache.

Chase
  • 9,289
  • 5
  • 51
  • 77
  • I opened the file with a browser I had not used to preview in and the css loaded fine so it is some kind of browser cache issue, but the string you posted left me with this error...Fatal error: Call to undefined function filetime() in C:\wamp\www\VE_2014\Includes\HEADER.php on line 20 Call Stack #TimeMemoryFunctionLocation 10.0005679360{main}( )..\index.php:0 20.0006683776require( 'C:\wamp\www\VE_2014\Includes\HEADER.php' )..\index.php:3 – David Fleury Oct 23 '13 at 22:29
  • @DavidFleury Your error didnt come through but im guessing it was a file not found. You need to put in the absolute file location for the css file, currently i was using a relative path. – Chase Oct 23 '13 at 22:31
  • Sorry there was a typo in the function name, its been corrected. It should be filemtime() i was missing the "m" – Chase Oct 23 '13 at 22:33
0
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">

Maybe "Custon_Foundation_Overides.css" is a typo and you meant "Custom_Foundation_Overrides.css" or maybe you have to upload the file with correct letters capitalization.