Jump to content

xml won't hold changes on server


offtheroad

Recommended Posts

When I make changes in my xml file on the server they won't change on my site. I'm on a Mac with the latest Snow Leopard OS. I use Transmit for my ftp browser. I tried editing the xml in Transmit but didn't stay. As soon as I refresh the browser it reverts back to the unchanged xml. I know nothing about php and was hoping someone can please look at my xml & php to see where the problem is. I've tried putting in the server.htaccess but still have the caching problem.Thank you

Link to comment
Share on other sites

Are you sure it's a caching issue? If you clear you browser's cache and revisit the page, do you see the new XML? If it's a caching issue, you should see the new file, since you'll have no cache.Also, the configuration file is called ".htaccess". If you've instead called it "server.htaccess", Apache won't read it. Also (just in case), make sure the web server is actually Apache, and not, say, IIS.If it is indeed a caching issue, and the file is indeed called ".htaccess", and it is still not working, show us the htaccess and/or PHP you're working with. A link would also be nice.

Link to comment
Share on other sites

Are you sure it's a caching issue? If you clear you browser's cache and revisit the page, do you see the new XML? If it's a caching issue, you should see the new file, since you'll have no cache.Also, the configuration file is called ".htaccess". If you've instead called it "server.htaccess", Apache won't read it. Also (just in case), make sure the web server is actually Apache, and not, say, IIS.If it is indeed a caching issue, and the file is indeed called ".htaccess", and it is still not working, show us the htaccess and/or PHP you're working with. A link would also be nice.
hereis the code for the.htaccess<FilesMatch "\.(php|xml)$"> Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"</FilesMatch>I can't see any where here to add attachments so I can send you the php.My siteonejimage.com
<?phpheader("Cache-Control: no-cache");header("Expires: -1");$sortorder =  $_REQUEST["sortorder"];$indir = "../galleries";$files = opendir($indir);$outxml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n";$outxml .= "<galleries>\n\n";	while ($file = readdir($files)) {  if(is_dir($indir.'/'.$file))  if ($file != '.' && $file != '..') {    {    	$tmp_outxml[] = $file;    }	}  }if ($sortorder == "date"){	foreach ($tmp_outxml as $k => $v)	{		$modified = filemtime ($indir.'/'.$v);		$moddate[$k] = $modified;	}	array_multisort ($moddate, $tmp_outxml);}else if ($sortorder == "random"){	shuffle ($tmp_outxml);}else{	sort ($tmp_outxml);}foreach ($tmp_outxml as $v){	$outxml .= get_folder_xml($indir.'/'.$v,$v);}$outxml .= "</galleries>";closedir($files);  $fp = fopen("../xml/gallery/gallery.xml", "w");fwrite($fp, $outxml);fclose($fp);function get_folder_xml($imageDir,$title)  {  $extensions = array(".jpg", ".jpeg", ".JPG",".JPEG",".gif",".GIF",".swf",".SWF");  $output = "";    if($folder = opendir($imageDir))    {    $filenames=array();            while (false !== ($file = readdir($folder)))      {      $dot = strrchr($file, '.');      if(in_array($dot, $extensions))        {        array_push($filenames, $file);        }               }     $spaceTitle = str_replace("_"," ",$title);     $newPath = str_replace("../","",$imageDir);    $output .= "<gallery>\n";     $output .= "<title>$spaceTitle</title>\n";	$output .= " <images>\n";    foreach ($filenames as $source)      {	  $imageName = str_replace("mainThumb_","",$source);      $finalName = str_replace("_"," ",$imageName);	      $imageName = str_replace($extensions,"",$finalName);      $output .= "\t <image src=\"$newPath/$source\" thumb=\"$newPath/thumbs/$source\">$imageName</image>\n";      }   $output .= " </images>\n";   $output .= "</gallery>\n\n";return $output;         closedir($folder);       }  }?>

Link to comment
Share on other sites

I see that it is Flash that requests these files in the end, and not IE itself. Perhaps Flash doesn't respect the Cache-Control directive. Setting the Expires header should fix this. Just make your pages expire immediatly. With that, Flash should make a request every time.Also, could it be that because the Flash itself is cached, that the related resources are cached? You might want to disable caching for the swf too. I think this should do it:

<FilesMatch "\.(php|xml|swf)$">Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"Header set Expires -1</FilesMatch>

Link to comment
Share on other sites

I see that it is Flash that requests these files in the end, and not IE itself. Perhaps Flash doesn't respect the Cache-Control directive. Setting the Expires header should fix this. Just make your pages expire immediatly. With that, Flash should make a request every time.Also, could it be that because the Flash itself is cached, that the related resources are cached? You might want to disable caching for the swf too. I think this should do it:
<FilesMatch "\.(php|xml|swf)$">Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"Header set Expires -1</FilesMatch>

3 questions:How do I disable caching for swf?Where do I pt this code you wrote? In place of the htaccess?How do I set the expire header? or is that what this code is for?Thank you very much, gotta go take care of my grand kids be back this afternoon.Thanks
Link to comment
Share on other sites

1. By adding it to the list of matched extensions in the .htaccess file, as the code above does it.2. Yes.3. Look at the second last line. That's one way to set the expires header. There is another if this one doesn't work.

Link to comment
Share on other sites

1. By adding it to the list of matched extensions in the .htaccess file, as the code above does it.2. Yes.3. Look at the second last line. That's one way to set the expires header. There is another if this one doesn't work.
Thanks for the help so far. I added that line of code Header set Expires -1 in the.htaccess made a small change in the xml and after 1 refresh the xml changed back. so what is the other method. Remember your not talking to a coder but an old timer but still trying to learn something new.
Link to comment
Share on other sites

You still haven't answered what happens if you clear your browser cache and try again... does the problem still occur? What about refreshing the page with CTRL+F5 instead of just F5? Does it still happen?

Link to comment
Share on other sites

You still haven't answered what happens if you clear your browser cache and try again... does the problem still occur? What about refreshing the page with CTRL+F5 instead of just F5? Does it still happen?
I tried clearing the browser cache right from the start and have been doing it all thru this mess and CTRL+F5 ? I'm on a Mac is that a quick key for clearing the browser cache? I put the .htaccess in the server at root level and not in any folders. Could it be a "buildGalleries.php' issue, I know nothing about php. I use firefox and refresh the page with the button (reload current page)
Link to comment
Share on other sites

What is that PHP script trying to do anyway? It looks to me as if it shouldn't even be working, due to syntax error(s?), and yet it does. Where's the connection with your XML files that Flash requests? I'm not sure I see the whole idea...Wait... could it be that the PHP script is overwriting your XML file? Answering the question "what do you use it for" will help answer if it is.

Link to comment
Share on other sites

What is that PHP script trying to do anyway? It looks to me as if it shouldn't even be working, due to syntax error(s?), and yet it does. Where's the connection with your XML files that Flash requests? I'm not sure I see the whole idea...Wait... could it be that the PHP script is overwriting your XML file? Answering the question "what do you use it for" will help answer if it is.
I'm not a coder, this was a template and I had someone months ago help me with it and they loaded the php into the server. I will give you access to the server but I'll need your email. Don't want to put a log & pw out onto a forum. I have no idea how php works, that's why I'm here. Thanks for your concern.
Link to comment
Share on other sites

  • 4 weeks later...
3 questions:How do I disable caching for swf?Where do I pt this code you wrote? In place of the htaccess?How do I set the expire header? or is that what this code is for?Thank you very much, gotta go take care of my grand kids be back this afternoon.Thanks
I'm still having caching problems. I just put that code in addition to the code in the.htaccess and when I make a change in the gallery.xml it's ok till I refresh then goes back to the way it was.So this is what I have in the .htaccess file<FilesMatch "\.(php|xml)$">Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"Header set Expires -1</FilesMatch><FilesMatch "\.(php|xml|swf)$">Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"Header set Expires -1</FilesMatch>
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...