<?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: Displaying a random image using PHP</title>
	<atom:link href="http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/</link>
	<description>Fixed price, low cost web design and hosting based in Harrogate, North Yorkshire</description>
	<lastBuildDate>Thu, 19 Jan 2012 02:29:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jim</title>
		<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/comment-page-1/#comment-483</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Sat, 31 Jan 2009 20:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinksynergy.co.uk/?p=333#comment-483</guid>
		<description>@Rarst: Yup, your way is simpler for sure, and I would probably do the same. The way I did it works for those situations where you want to grab from a load of images you don&#039;t pre-name for the script i.e. if you don&#039;t have control over the filenames.

Like all these solutions, sometimes the simpler ways are the best, but like Lyndi said, there&#039;s more than one way to skin a cat :D

Thanks for the comment :D</description>
		<content:encoded><![CDATA[<p>@Rarst: Yup, your way is simpler for sure, and I would probably do the same. The way I did it works for those situations where you want to grab from a load of images you don&#8217;t pre-name for the script i.e. if you don&#8217;t have control over the filenames.</p>
<p>Like all these solutions, sometimes the simpler ways are the best, but like Lyndi said, there&#8217;s more than one way to skin a cat <img src='http://www.thinksynergy.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Thanks for the comment <img src='http://www.thinksynergy.co.uk/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rarst</title>
		<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/comment-page-1/#comment-482</link>
		<dc:creator>Rarst</dc:creator>
		<pubDate>Sat, 31 Jan 2009 20:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinksynergy.co.uk/?p=333#comment-482</guid>
		<description>Good snippet if images are going to change. For static set of images I am sticiking with my tiny &quot;generate random number and stuck it into URL&quot; approach.</description>
		<content:encoded><![CDATA[<p>Good snippet if images are going to change. For static set of images I am sticiking with my tiny &#8220;generate random number and stuck it into URL&#8221; approach.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lyndi</title>
		<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/comment-page-1/#comment-480</link>
		<dc:creator>Lyndi</dc:creator>
		<pubDate>Sat, 31 Jan 2009 17:24:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinksynergy.co.uk/?p=333#comment-480</guid>
		<description>Two good ideas here. Firstly using PHP to create the JS and then of course the whole idea of an array. Many WordPress blogs are using the caching plugin and it is definitely something to keep in mind these days. I will keep you informed if I can come up with anything that actually works alongside caching.</description>
		<content:encoded><![CDATA[<p>Two good ideas here. Firstly using PHP to create the JS and then of course the whole idea of an array. Many WordPress blogs are using the caching plugin and it is definitely something to keep in mind these days. I will keep you informed if I can come up with anything that actually works alongside caching.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/comment-page-1/#comment-479</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Sat, 31 Jan 2009 17:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinksynergy.co.uk/?p=333#comment-479</guid>
		<description>Mmm, I was going to reply that you can&#039;t do this in javascript, as the script needs to read the file data from the server, and javascript is client side.

But, that got me thinking, how&#039;s about taking the filenames as an array in PHP and using PHP to build the javascript? The cache issues would also be avoided, as the content of the array would only change when the directory is updated?

I don&#039;t currently have a requirement for such a script, so I doubt I will take this further myself, but it is certainly something to keep in mind if you really do need it server from cache.</description>
		<content:encoded><![CDATA[<p>Mmm, I was going to reply that you can&#8217;t do this in javascript, as the script needs to read the file data from the server, and javascript is client side.</p>
<p>But, that got me thinking, how&#8217;s about taking the filenames as an array in PHP and using PHP to build the javascript? The cache issues would also be avoided, as the content of the array would only change when the directory is updated?</p>
<p>I don&#8217;t currently have a requirement for such a script, so I doubt I will take this further myself, but it is certainly something to keep in mind if you really do need it server from cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lyndi</title>
		<link>http://www.thinksynergy.co.uk/2009/01/31/displaying-a-random-image-using-php/comment-page-1/#comment-478</link>
		<dc:creator>Lyndi</dc:creator>
		<pubDate>Sat, 31 Jan 2009 17:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinksynergy.co.uk/?p=333#comment-478</guid>
		<description>A good idea. It could also be changed a little bit to select images that were stored in the database e.g. you could create a separate link category, attach graphics to the items added to this category and then select from these images at random.

This idea is good, it gives us more choices, but still we have the problem of the server side code not being called if a page is served from cache. I am still too inexperienced with Javascript but if we could code this idea of yours in JS we would have a far better solution than my original idea. We could then have a situation where we do not have to hard code the details of the graphic, and it would work even if the page was served from cache.

As soon as I have a bit of time I am definitely going to play with this some more. I am going to &#039;steal&#039; your idea and try to get it to work in JS.</description>
		<content:encoded><![CDATA[<p>A good idea. It could also be changed a little bit to select images that were stored in the database e.g. you could create a separate link category, attach graphics to the items added to this category and then select from these images at random.</p>
<p>This idea is good, it gives us more choices, but still we have the problem of the server side code not being called if a page is served from cache. I am still too inexperienced with Javascript but if we could code this idea of yours in JS we would have a far better solution than my original idea. We could then have a situation where we do not have to hard code the details of the graphic, and it would work even if the page was served from cache.</p>
<p>As soon as I have a bit of time I am definitely going to play with this some more. I am going to &#8216;steal&#8217; your idea and try to get it to work in JS.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

