Sign in to follow this  
Pallav

Stop Caching PHP

Recommended Posts

I keep getting the same chart. My PHP page is succesfully recieving my variable via the URL and XML code is written correctly but the last chart keeps showing.

I found a post where a JavaScript solution was shown but I dont think it will work with my PHP.

I am including the FusionCharts.php file and have found the following code, however it is not clear. Can I change something here to fix?

// encodeDataURL function encodes the dataURL before it's served to FusionCharts.
// If you've parameters in your dataURL, you necessarily need to encode it.
// Param: $strDataURL - dataURL to be fed to chart
// Param: $addNoCacheStr - Whether to add aditional string to URL to disable caching of data
function encodeDataURL($strDataURL, $addNoCacheStr=false) {
   //Add the no-cache string if required.. DO I CHANGE THE FOLLOWING TO $strDataURL  ?
   if ($addNoCacheStr==true) {
    // We add ?FCCurrTime=xxyyzz
    // If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz
    // We replace : with _, as FusionCharts cannot handle : in URLs
 if (strpos(strDataURL,"?")<>0)
  $strDataURL .= "&FCCurrTime=" . Date("H_i_s");
 else
  $strDataURL .= "?FCCurrTime=" . Date("H_i_s");
   }
 // URL Encode it
 return urlencode($strDataURL);
}

Please advise.

Thanks.

Share this post


Link to post
Share on other sites
Pallav (2/2/2007)
Yes - you'll need to add the date/time at the end of $strDataURL

Im sorry, this is still not clear.

Below is where I render the chart. And this is what appears to be caching. Do I need to add date/time after OneProbe.xml ?? If so what format??

<table border="1" cellspacing="2" WIDTH=80% ALIGN=CENTER

<?php

  //Create the chart - Column 3D Chart with data from Data/Data.xml

  echo renderChartHTML("FusionCharts/Charts/Line.swf", "OneProbe.xml", "", "myFirst", 750, 450, false);

?>

</table>

ALSO...

Do I need to change something in the FusionCharts.php file? Does $addNoCacheStr need to be set to true? Please clarify how to stop the same chart from loading.

Thank you very much.

// encodeDataURL function encodes the dataURL before it's served to FusionCharts.

// If you've parameters in your dataURL, you necessarily need to encode it.

// Param: $strDataURL - dataURL to be fed to chart

// Param: $addNoCacheStr - Whether to add aditional string to URL to disable caching of data

function encodeDataURL($strDataURL, $addNoCacheStr=false) {

  //Add the no-cache string if required

  if ($addNoCacheStr==true) {

  // We add ?FCCurrTime=xxyyzz

  // If the dataURL already contains a ?, we add &FCCurrTime=xxyyzz

  // We replace : with _, as FusionCharts cannot handle : in URLs

if (strpos(strDataURL,"?")<>0)

 $strDataURL .= "&FCCurrTime=" . Date("H_i_s");

else

 $strDataURL .= "?FCCurrTime=" . Date("H_i_s");

  }

 // URL Encode it

 return urlencode($strDataURL);

}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this