|
Posted by Amanda H. on 02/18/06 11:23
I posted about this a few days ago, and I got a few suggestions that
fixed part of my problem.
I am using a PHP script to switch external style sheets when the viewer
clicks on the style link. Search "Amanda H." in this group and you can
view my last post to see the original PHP and html junk. This below is
the updated link rel and the meta tags.
Before, it wouldn't refresh or change in Opera, Firefox, or IE6/Win &
IE5/Mac. The bits added on to the link rel and adding the meta tags
worked for Firefox and Opera.
In IE6/Win, the style sheet loads, but a manual refresh makes it
actually load. In IE5/Mac, the style sheets won't switch at all. I
don't know PHP very well, so I don't know what the problem could be.
Any help would be greatly appreciated. Here's the script and code:
-------------------------
<?
header('Content-Type: text/css');
// CONFIGURATION
// If you want to specify a default CSS file for users who can't handle
// cookies, replace styles.css with the filename below:
$basicsheet = "basic.css";
// CHECK IF NEW STYLESHEET IS BEING LOADED
if(isset($_GET['sheet']) OR isset($_POST['sheet'])) {
// CHECK IF FILE IS SPECIFIED IN URL
if(isset($_GET['sheet'])) { $newsheet = $_GET['sheet']; }
// CHECK IF FILE IS SPECIFIED IN FORM DATA
if(isset($_POST['sheet'])) { $newsheet = $_POST['sheet']; }
// MAKE THE USER REMEMBER WHICH STYLESHEET IS LOADED
setcookie("my_stylesheet", "$newsheet.css", 0, "/");
// SEND THE USER BACK
$ref = $_SERVER['HTTP_REFERER'];
header("Location: $ref");
} else {
// NORMAL STYLESHEET REQUEST
$mysheet = $_COOKIE['my_stylesheet'];
if($mysheet == "") { $mysheet = $basicsheet; }
include "$mysheet";
}
?>
-----------------------------------------
---end of PHP script. Then the new link header & meta tags for the
HTML file:
<link rel="stylesheet" type="text/css"
href="http://www.amandahenson.com/styleswitcher.php?<?php echo time();
?>" />
and
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
-------------------------------------
---end. It works in most browsers, but it still has those problems
with the browsers mentioned above. Thanks ahead of time.
Amanda H.
[Back to original message]
|