<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating XML from PHP/ MySQL for use with SPRY</title>
	<atom:link href="http://luckylarry.co.uk/programming-tutorials/javascript/creating-xml-from-php-mysql-for-use-with-spry/feed/" rel="self" type="application/rss+xml" />
	<link>http://luckylarry.co.uk/programming-tutorials/javascript/creating-xml-from-php-mysql-for-use-with-spry/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 14:19:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=331</generator>
	<item>
		<title>By: Jeff K</title>
		<link>http://luckylarry.co.uk/programming-tutorials/javascript/creating-xml-from-php-mysql-for-use-with-spry/comment-page-1/#comment-1318</link>
		<dc:creator>Jeff K</dc:creator>
		<pubDate>Tue, 16 Feb 2010 16:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=7#comment-1318</guid>
		<description>thanks Larry will check this out.</description>
		<content:encoded><![CDATA[<p>thanks Larry will check this out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry</title>
		<link>http://luckylarry.co.uk/programming-tutorials/javascript/creating-xml-from-php-mysql-for-use-with-spry/comment-page-1/#comment-1316</link>
		<dc:creator>larry</dc:creator>
		<pubDate>Tue, 16 Feb 2010 12:13:54 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=7#comment-1316</guid>
		<description>Hi Jeff,

To get the database to refresh periodically you would need to run your PHP script from the server on a scheduled task/ cron job. Some web hosts allow you do this. But thats if you want to refresh once an hour or something

Although everytime you call your XML in the example its actually calling that PHP page and running the query each time so its currently realtime but your browser is caching the result so you don&#039;t see the updates.

However with XML there is caching and a &#039;time to live&#039; (TTL) before the content expires in the browser. If these values aren&#039;t set in the XML output of the PHP page then the XML object will be cached so you won&#039;t see the change.

To alter this you can add in the XML parameters (I think) for TTL much like an RSS feed. But you can also force the XML to always render from the server and not the browser cache by adding a time stamp to the query URL so the browser always sees it as a unique file therefore it will always update.

So try changing the URL you query in the ajax/spry call to: 

var timestamp=getTime();
var url=&quot;queryBuilder.php&quot;;
url=url+&quot;?q=&quot;+str+&quot;&amp;ts=&quot;+timestamp;

Then the query is always unique - I think and that *should* force the browser to avoid using the cache, although that may mean it starts caching each new request. 

Anyway hope that helps you out, I can&#039;t currently test my theory as I&#039;m at work.

Larry</description>
		<content:encoded><![CDATA[<p>Hi Jeff,</p>
<p>To get the database to refresh periodically you would need to run your PHP script from the server on a scheduled task/ cron job. Some web hosts allow you do this. But thats if you want to refresh once an hour or something</p>
<p>Although everytime you call your XML in the example its actually calling that PHP page and running the query each time so its currently realtime but your browser is caching the result so you don&#8217;t see the updates.</p>
<p>However with XML there is caching and a &#8216;time to live&#8217; (TTL) before the content expires in the browser. If these values aren&#8217;t set in the XML output of the PHP page then the XML object will be cached so you won&#8217;t see the change.</p>
<p>To alter this you can add in the XML parameters (I think) for TTL much like an RSS feed. But you can also force the XML to always render from the server and not the browser cache by adding a time stamp to the query URL so the browser always sees it as a unique file therefore it will always update.</p>
<p>So try changing the URL you query in the ajax/spry call to: </p>
<p>var timestamp=getTime();<br />
var url=&#8221;queryBuilder.php&#8221;;<br />
url=url+&#8221;?q=&#8221;+str+&#8221;&amp;ts=&#8221;+timestamp;</p>
<p>Then the query is always unique &#8211; I think and that *should* force the browser to avoid using the cache, although that may mean it starts caching each new request. </p>
<p>Anyway hope that helps you out, I can&#8217;t currently test my theory as I&#8217;m at work.</p>
<p>Larry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff K</title>
		<link>http://luckylarry.co.uk/programming-tutorials/javascript/creating-xml-from-php-mysql-for-use-with-spry/comment-page-1/#comment-1315</link>
		<dc:creator>Jeff K</dc:creator>
		<pubDate>Tue, 16 Feb 2010 09:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://luckylarry.co.uk/?p=7#comment-1315</guid>
		<description>Larry - what pieces would be modified to keep checking the database for changes to the query results every few seconds? any more pointers/samples on how to do so? it seems to be the piece i&#039;ve missed in searching this topic out everywhere.

the link below shows how to get spry to check its xml file source periodically. but i&#039;m stuck on what to do to get the database re-queried and the xml file updated regularly:

http://labs.adobe.com/technologies/spry/articles/data_set_overview/</description>
		<content:encoded><![CDATA[<p>Larry &#8211; what pieces would be modified to keep checking the database for changes to the query results every few seconds? any more pointers/samples on how to do so? it seems to be the piece i&#8217;ve missed in searching this topic out everywhere.</p>
<p>the link below shows how to get spry to check its xml file source periodically. but i&#8217;m stuck on what to do to get the database re-queried and the xml file updated regularly:</p>
<p><a href="http://labs.adobe.com/technologies/spry/articles/data_set_overview/"  rel="nofollow">http://labs.adobe.com/technologies/spry/articles/data_set_overview/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

