<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rabidGadfly &#187; PHP</title>
	<atom:link href="http://rabidgadfly.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://rabidgadfly.com</link>
	<description>Simple Solutions to Nagging Coding Problems</description>
	<lastBuildDate>Wed, 19 Oct 2011 13:43:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>How to Install PHP on IIS 6.0</title>
		<link>http://rabidgadfly.com/2008/02/how-to-install-php-on-iis-60/</link>
		<comments>http://rabidgadfly.com/2008/02/how-to-install-php-on-iis-60/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 03:02:38 +0000</pubDate>
		<dc:creator>rabidgadfly</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.rabidgadfly.com/?p=56</guid>
		<description><![CDATA[I just found myself needing to install PHP manually on a Windows 2003 VPS server using IIS 6.0. While I&#8217;ve use PHP before, I am by no means an expert on it and this was to be my first installation. Since I needed a secure environment, I needed to install PHP manualy (rather than with [...]]]></description>
			<content:encoded><![CDATA[<p>I just found myself needing to install PHP manually on a Windows 2003 VPS server using IIS 6.0. While I&#8217;ve use PHP before, I am by no means an expert on it and this was to be my first installation.</p>
<p>Since I needed a secure environment, I needed to install PHP manualy (rather than with the MSI). I downloaded PHP and started following the instructions on php.net. The documentation wasn&#8217;t bad but seemed a bit more complicated than it needed to be.</p>
<p>As I was clicking from one page to the next I noticed a comment at the bottom of the page from someone named Paul Lynch who said he wrote a simple set of instructions. Curiosity, and the promise of simplicity, got the best of me so I followed the link.</p>
<p>I couldn&#8217;t be happier with my decision. Paul&#8217;s tutorial is simple, informative and to the point. I finished up the installation and had a test page working in less than 10 minutes.</p>
<p>For anyone looking for a PHP installation guide, I highly recommend checking out <a href="http://www.iisadmin.co.uk/?p=4">Paul&#8217;s tutorial</a>.</p>
<p>-rG</p>
]]></content:encoded>
			<wfw:commentRss>http://rabidgadfly.com/2008/02/how-to-install-php-on-iis-60/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows vs. Linux Directory Sorting</title>
		<link>http://rabidgadfly.com/2006/07/windows-vs-linux-directory-sorting/</link>
		<comments>http://rabidgadfly.com/2006/07/windows-vs-linux-directory-sorting/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 17:02:12 +0000</pubDate>
		<dc:creator>rabidgadfly</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.rabidgadfly.com/?p=11</guid>
		<description><![CDATA[I&#8217;m developing a site on a Windows host for a client whose site is hosted on Linux and just ran into an unexpected issue. My PHP code is supposed to display all of the images in a particular folder on a page. I renamed all of the images so they&#8217;d be read in the order [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m developing a site on a Windows host for a client whose site is hosted on Linux and just ran into an unexpected issue. My PHP code is supposed to display all of the images in a particular folder on a page. I renamed all of the images so they&#8217;d be read in the order I wanted them displayed. My code looked something like this:</p>
<p>$path = &#8216;images/thumbs&#8217;;<br />
$folder = dir($path);<br />
	while($img=$folder-&gt;read()) {<br />
		if($img== &#8220;.&#8221; || $img== &#8220;..&#8221;) continue;<br />
		echo &#8216;<br />
&lt;div id=&#8221;imgPod&#8221;&gt;</p>
<ul>
&lt;div id=&#8221;image&#8221;&gt;</p>
<ul>&lt;a href=&#8221;images/&#8217;.$img.&#8217;&#8221; &lt;img src=&#8221;&#8216;.&#8221;$path/$img&#8221;.&#8217;&#8221; /&gt;&lt;/a&gt;</ul>
<p>&lt;/div&gt;
</ul>
<p>&lt;/div&gt;&#8217;;<br />
	}</p>
<p>The sorting worked like a charm on my host but when I published it live the images were scrambled. Turns out Linux doesn&#8217;t read the files in alphabetical order. What I had to do instead was to first read the filenames into an array, then sort the array and display the images in the order of the newly sorted array. The new code:</p>
<p>$path = &#8216;images/thumbs&#8217;;<br />
$folder = dir($path);<br />
$img_array = array();<br />
while($img=$folder-&gt;read()) {<br />
     if($img== &#8220;.&#8221; || $img== &#8220;..&#8221;) continue;<br />
     $img_array[] = $img;<br />
}</p>
<p>sort($img_array);<br />
		foreach ($img_array as $image) {echo &#8216;<br />
&lt;div id=&#8221;imgPod&#8221;&gt;</p>
<ul>
&lt;div id=&#8221;image&#8221;&gt;</p>
<ul>
&lt;a href=&#8221;images/&#8217;.$image.&#8217;&#8221; &lt;img src=&#8221;&#8216;.&#8221;$path/$image&#8221;.&#8217;&#8221; /&gt;&lt;/a&gt;</ul>
<p>&lt;/div&gt;</ul>
<p>&lt;/div&gt;&#8217;;<br />
	}</p>
<p>Not much extra coding and it worked great.</p>
]]></content:encoded>
			<wfw:commentRss>http://rabidgadfly.com/2006/07/windows-vs-linux-directory-sorting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP redirect a la Javascript</title>
		<link>http://rabidgadfly.com/2006/06/php-redirect-a-la-javascript/</link>
		<comments>http://rabidgadfly.com/2006/06/php-redirect-a-la-javascript/#comments</comments>
		<pubDate>Mon, 12 Jun 2006 13:22:06 +0000</pubDate>
		<dc:creator>rabidgadfly</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.rabidgadfly.com/?p=10</guid>
		<description><![CDATA[So, I&#8217;ve been dabbling in PHP a bit and I needed to find out how to redirect in the middle of a page. I couldn&#8217;t find anything simple to achieve this so I wondered if it was possible to use echo a location.href in the midst of my PHP code. Turns out, it is! The [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been dabbling in PHP a bit and I needed to find out how to redirect in the middle of a page. I couldn&#8217;t find anything simple to achieve this so I wondered if it was possible to use echo a location.href in the midst of my PHP code. Turns out, it is!</p>
<p>The following snippet looks for a URL parameter named <em>page</em>. If no parameter was passed, the page will reload with a page parameter of page1:</p>
<blockquote><p>
&lt;?php<br />
if (isset($_GET['page'])) {<br />
     $pathToPage = sprintf(&#8220;%s%s.php&#8221;, &#8216;myfolder/&#8217;,$_GET['page']);<br />
} else {<br />
     echo &#8216;&lt;script>location.href=&#8221;template.php?pg=page1&#8243;;&lt;/script>&#8217; ;<br />
}<br />
?>
</p></blockquote>
<p>Since it&#8217;s part of the example I should mention that sprintf is a fantastic substitution function that makes life a lot easier. In my example it is substituting the instances of %s with a folder name and a page name read from a URL parameter named <em>page</em>. For example, if the value of page was &#8216;page2&#8242;, the resulting string would be:  &#8216;myfolder/page2.php&#8217;. Pretty slick!</p>
]]></content:encoded>
			<wfw:commentRss>http://rabidgadfly.com/2006/06/php-redirect-a-la-javascript/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

