I had someone duplicate my old website back in the day, and I'm having issues with it. Unfortunately the person who did it is no longer active, so I cannot retreive his support. URL: http://www.helter.org Problem: When I click the themes at the bottom of the site, they don't change unless I actually hit f5 to refresh the page. I want them to change accordingly when clicked to the proper .css - Even sometimes when I refresh they screw up and load like half a blue template and half a grey? I don't get what is wrong, and could use some help! Thanks!
Assuming it's a cache problem, I fixed the half blue half grey problem, just need to fix the other problem still...any help?
<? session_start(); if(isset($_GET['shade'])) { $_SESSION['shade']=$_GET['shade']; header("Location: ".$_SERVER['HTTP_REFERER']); } if($_SESSION['shade']=="") { $_SESSION['shade']="yellow"; } //echo $_SESSION['shade']."<br>"; ?> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- base href="http://www.craq.org/" --> <title>CraQ [dot] Org</title><link rel="stylesheet" type="text/css" href="styles/index-<?=$_SESSION['shade']?>.css"><title>CraQ [dot] Org</title></head><body class="index-body" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" background="CraQ%20%5Bdot%5D%20Org_files/a.htm"> <table class="tables" id="table1" cellspacing="0" width="100%" height="100%"> <tbody><tr> <td class="top-table" colspan="1" align="left" valign="top" height="21"><b>IP</b>: <?=$_SERVER['REMOTE_ADDR']?></td> <td class="top-table" colspan="3" align="right" valign="top" height="21">Welcome to <b>http://craq.org</b></td> </tr> <tr> <td colspan="3" valign="top" height="20%"> </td> </tr> <tr> <td valign="top" width="19%"> </td> <td valign="top" width="62%"> <center><font size="4"><a href="main.php"><img src="images/splash-<?=$_SESSION['shade']?>.jpg" border="0" width="400" height="400"></a> </font> </center></td> <td valign="top" width="19%"> </td> </tr> <tr> <td colspan="3" valign="top" height="20%"> </td> </tr> <tr> <td class="bottom-table" colspan="3" valign="top" height="81"> <center> Themes<br><br> <a href="index.php?shade=yellow"><img src="images/yellow.jpg" border="0" width="50" height="50"></a> <a href="index.php?shade=grey"><img src="images/grey.jpg" border="0" width="50" height="50"></a> <a href="index.php?shade=blue"><img src="images/blue.jpg" border="0" width="50" height="50"></a> <a href="index.php?shade=purple"><img src="images/purple.jpg" border="0" width="50" height="50"></a> <a href="index.php?shade=teal"><img src="images/teal.jpg" border="0" width="50" height="50"></a> </center></td> </tr> </tbody></table> </body></html> Code (markup):
That seemed to work great! Thanks! May i ask how you did it? I'm assuming this line you changed? <link rel="stylesheet" type="text/css" href="styles/index-<?php echo $_SESSION['shade']?>.css"> Code (markup): If there was anything else please let me know for future reference!
Changed the php code, removed the header redirect then checked if session(shade) isset, if not applied default css yello <?php session_start(); if(isset($_GET['shade'])) { $_SESSION['shade']=$_GET['shade']; } if(empty($_SESSION['shade']) || (!isset($_SESSION['shade']))) // here { $_SESSION['shade']="yellow"; } //echo $_SESSION['shade']."<br>"; ?> Code (markup): and here, removed the short tag for php <? and replaced with php long tag <?php (recommended) <?php echo $_SESSION['shade']?> Code (markup):
long tags are recommended only in case you move your script on a server where short tags are not activated. If you work in a non moving project with a current hosting solution, there's nothing wrong using short tags. It s quite handy for perl like tests and echo =.