Hello,
I am trying to run an html page that queries database (takes a few minutes) and then stores an html output in the buffer. I output the buffer into a string and register the string in the session. From that point on I want this page to show the session variable (buffer) as opposed to querrying for data again (until i clean the buffer variable from session). This is basically cashing the page for me in the session. The problem I'm getting is that the session_registered buffer variable appears to be of zero length once I call it from the session. Here is my code:
At the beginning of the html file i call this function:
function displayBuffer()
{
if(!session_is_registered('buffered_html'))
{
ob_start();
}
else
{
echo $buffered_html;
echo "<br>Should have returned Buffered HTML";
exit;
}
}
displayBuffer();
<--- then its all the usual html including the query, tables, etc -->
then at the end of the file i call this:
function setBuffer()
{
if(!session_is_registered('buffered_html'))
{
$buffered_html = ob_get_clean();
session_register('buffered_html');
echo "HERE: setting buffer!";
}
else
{
echo "HERE: did not set buffer!";
}
}
setBuffer();
what happens is that once i come back to the page, the buffer is recognized so the page does not query but still does not display buffer, and buffer variable seems to be of zero length... any ideas?
sf