sweetname Posted October 8, 2008 Share Posted October 8, 2008 Hi. I googled this and searched the forum and couldn't find anything, so sorry if this is supposed to be common knowledge. I have a page that correctly displays in ie6 with the css provided as: <link href="/css/style.css" rel="stylesheet" type="text/css" media="all"/> However if I use a php extension <link href="/css/style.php" rel="stylesheet" type="text/css" media="all"/> the page displays as if it has no css style attached to it unless the page is refreshed. Then after a refresh it displays properly. The css provided by the php script and the .css file is the same because I just copied it from the style.php output. The only difference in the page is that link statement, so that has to be what is causing the problem. Has anyone had this problem before? And is there any way to fix it without forcing my webserver to parse all css files as php? I found this a strange problem because I.E. 5 displays fine and so does I.E. 7. Hopefully someone can solve this? =) Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/ Share on other sites More sharing options...
CroNiX Posted October 8, 2008 Share Posted October 8, 2008 Someone might have a better answer, but to get it to load a php page I think you might just have to include it and not use a link. <?php include("/css/style.php"); Then at the top of your style.php you would have to insert the <style type="text/css"> ... </style> The problem with this is that your css will never get cached by the browser and it will need to be loaded every time. Side note: You actually test using IE5? I don't even test for IE6 anymore unless the client demands it, then I charge a little extra for it due to the extra crap that needs to be added because its an 'outdated' browser. Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/#findComment-660298 Share on other sites More sharing options...
sKunKbad Posted October 8, 2008 Share Posted October 8, 2008 First you might try adding the header for css to the top of the php: <?php header("Content-Type: text/css") ?> IE6 definitely has a problem with gzip compression. If you have gzip compression turned on, this is almost for sure the reason why IE6 has issues. Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/#findComment-660307 Share on other sites More sharing options...
sweetname Posted October 8, 2008 Author Share Posted October 8, 2008 First off, thank you for the replies =) I am sending the css header. I am not caching it atm b/c I am updating it, but php can be cached if you output the headers correctly. If you include it like that in each page then you have defeated the whole purpose of using an external stylesheet. Unless you are talking about including it in a css file (I may have misread your reply)? But then I would have to force apache to treat all of my .css as php files which is what I am trying to avoid. I don't know if I made it clear in my first post... IE6 will use the php code as css. It just won't do it until you refresh the page. Like you load the page and you have a page with no styles (the page has the default white background and the content is displayed as it is typed in the source). I am hoping someone knows a way to get IE6 to use the css in a php file without refreshing, or if someone knows it can't be done that would be just as good I guess. I think I have given enough information, but if I have left something out you need just let me know and I'll post it. Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/#findComment-660323 Share on other sites More sharing options...
sweetname Posted October 10, 2008 Author Share Posted October 10, 2008 Sorry Skunkbad, I totally missed your comment about gzip compression giving ie6 trouble. That was it. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/#findComment-661534 Share on other sites More sharing options...
sKunKbad Posted October 11, 2008 Share Posted October 11, 2008 I only knew about the gzip issue because I dealt with the same issue about 2 weeks ago. Quote Link to comment https://forums.phpfreaks.com/topic/127598-solved-ie6-css-as-php/#findComment-662438 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.