Jump to content

[SOLVED] ie6 css as php


sweetname

Recommended Posts

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? =)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.