Forum Moderators: coopster
I have opera 9.0. and when I open a web page with opera with any php applications that are supposed to change on page load, Opera doesn't seem to be working right. When the page is viewed through the opera browser it doesn't refresh the first time when the page opens. It only refreshes and changes an item when you click opera's refresh button. This is just one example of what I mean.
Quote:
<?php $this = rand(1,15);
$includeit = "on" . $this . ".txt";
include ($includeit);?>
Codes like this are supposed to show a different item
on page load. But when opera first opens to the page address,
it is still showing the last random item.
I really don't believe your supposed to click opera's refresh button when you first open a web page. I relieve believe its supposed to show an different item each time. Can someone tell me what is happening with only Opera or if I am doing something wrong? Thank you very much.
[edited by: CDNQuilter at 5:34 am (utc) on June 11, 2007]
It only sees the html generated at the server by your php.
So it has to be either a cache issue or something somewhere else in your code.
To set the browser so that it always loads a fresh page, do not use the tools/advanced
use tools/preferences/advanced/history
Beside the Disk cache drop down box, click on Empty Cache
and in the drop down box beside
check documents
select 'always'
How many different pages are you choosing from? A random selection means that there is a definite chance that sometimes the same page as the one you are viewing will be chosen. If you have only a few pages to select from, then this will happen fairly frequently.
#taken from manual
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
Its not a random issue picking the same item, this same thing happens on other codes that aren't picked randomly.
[edited by: Simone100 at 10:55 pm (utc) on June 11, 2007]
That means exactly what it says, you have had headers sent out before you called this function. You must have the code I gave you at the very top of the script before any output is sent to the browser (this includes text, whitespace, etc...)
Is it talking about conflicting with a html header at the top of the page?
This is how the top of the page looks.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<title>starter</title>
<style type="text/css">
.main { border: 5px solid rgb(0, 0, 0);
margin: auto;
width: 600px;
}
.body { margin: auto;
display: block;
width: 100%;
height: 100px;
}
</style>
</head>
<body>
make sure that no include file outputs anything before headers.
check whitespaces in your scrip[t, in includes, in everything
check error reporting (you'll never know)
if you still see this message, check again.
Try testing this page in IE and Opera. If it works on one, then its cashe problem, else .... check again.
Sorry, but there isnt much you can do in this case (at least none that i am familiar with).
If anyone has any suggestion, please let us know.
So this header didn't help.
I really don't get it, doesn't opera honor php? By doing a page refresh when it first opens a page or comes back to a page from another page? Seeing if I can find an opera forum in these forums.
The browser doesn't get the php code - only what the php outputs.
>> Seeing if I can find an opera forum in these forums.
[webmasterworld.com...]
It definitely is a cache problem, however, I cannot figure out why.