<?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>media&#124;extranet &#187; PHP</title>
	<atom:link href="http://www.mediaextra.net/category/scripting/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mediaextra.net</link>
	<description>campaign, connect and conquor</description>
	<lastBuildDate>Thu, 04 Mar 2010 05:23:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JQuery, Prototype, Mootools?</title>
		<link>http://www.mediaextra.net/2010/workflow/jquery-prototype-mootools/</link>
		<comments>http://www.mediaextra.net/2010/workflow/jquery-prototype-mootools/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 05:14:19 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/2010/workflow/jquery-prototype-mootools/</guid>
		<description><![CDATA[Okay, so there are a seemingly endless supply of javascript frameworks for you to develop with, so which one is right for you?
Maybe a better way to go about this subject is how I arrived at my chosen framework. I used to be all about Mootools by default, maybe it was the name, maybe the [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so there are a seemingly endless supply of javascript frameworks for you to develop with, so which one is right for you?</p>
<p>Maybe a better way to go about this subject is how I arrived at my chosen framework. I used to be all about Mootools by default, maybe it was the name, maybe the fact I like beef, maybe that I really dug their web site. I eventually (after sporadically testing different frameworks) arrived at JQuery as my default. So what made me choose JQuery over the countless others? Plain and simple it was the community support. Having a great framework or script is all well and good, but when you have a great user base out there that shares their innovations and discoveries then it makes it all the better. It probably didn’t hurt that in my employment we write in .NET technology and in that technology Microsoft decided that it would embrace JQuery as it’s default framework for Javascript going forward, so for me that’s a Win/Win. I program in .NET at work but do a lot of PHP stuff in my offtime, so a framework that appeals to both androgynously really perked up my senses.</p>
<p>So what is your preferred framework, and why?</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F&amp;t=JQuery%2C%20Prototype%2C%20Mootools%3F" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F&amp;title=JQuery%2C%20Prototype%2C%20Mootools%3F" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F&amp;title=JQuery%2C%20Prototype%2C%20Mootools%3F&amp;notes=Okay%2C%20so%20there%20are%20a%20seemingly%20endless%20supply%20of%20javascript%20frameworks%20for%20you%20to%20develop%20with%2C%20so%20which%20one%20is%20right%20for%20you%3F%0D%0A%0D%0AMaybe%20a%20better%20way%20to%20go%20about%20this%20subject%20is%20how%20I%20arrived%20at%20my%20chosen%20framework.%20I%20used%20to%20be%20all%20about%20Mootools%20by%20" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F&amp;title=JQuery%2C%20Prototype%2C%20Mootools%3F" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Fjquery-prototype-mootools%2F&amp;title=JQuery%2C%20Prototype%2C%20Mootools%3F&amp;bodytext=Okay%2C%20so%20there%20are%20a%20seemingly%20endless%20supply%20of%20javascript%20frameworks%20for%20you%20to%20develop%20with%2C%20so%20which%20one%20is%20right%20for%20you%3F%0D%0A%0D%0AMaybe%20a%20better%20way%20to%20go%20about%20this%20subject%20is%20how%20I%20arrived%20at%20my%20chosen%20framework.%20I%20used%20to%20be%20all%20about%20Mootools%20by%20" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2010/workflow/jquery-prototype-mootools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips on Local Development</title>
		<link>http://www.mediaextra.net/2010/workflow/tips-on-local-development/</link>
		<comments>http://www.mediaextra.net/2010/workflow/tips-on-local-development/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 05:53:36 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/?p=57</guid>
		<description><![CDATA[Okay, so I've posted before about MAMP, XAMPP and the alternatives but now I'm going to dig a bit deeper into tricks and tips. Bear in mind that I'm writing this on how I do my development and your software choices and the like may be somewhat different than mine.
Localhost: 	XAMPP
Language:		PHP
Database:		Sequel Pro
Editor:		Coda
OS:			Snow Leopard
I usually set [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so I've posted before about MAMP, XAMPP and the alternatives but now I'm going to dig a bit deeper into tricks and tips. Bear in mind that I'm writing this on how I do my development and your software choices and the like may be somewhat different than mine.</p>
<p>Localhost: 	<a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a><br />
Language:		<a href="http://www.php.net/">PHP</a><br />
Database:		<a href="http://www.sequelpro.com/">Sequel Pro</a><br />
Editor:		<a href="http://panic.com/coda/">Coda</a><br />
OS:			<a href="http://www.apple.com/macosx/">Snow Leopard</a></p>
<p>I usually set up my sites in the Default <strong>~/Sites</strong> folder on my Mac, just to keep things in one area mainly and for this demo we'll be using stardup.com (a domain I own and have never really done anything with due to time restraints).</p>
<p>I found this tutorial online a while back by <a href="http://www.acwolf.com/2009/02/24/xampp-virtual-hosts-on-a-mac/">Arron Wolf</a> and it was a really good way to keep my logical file structure instead of duping directories back and forth from XAMPP's native htdocs folder. This is not super intense a process even though some people may shy away from Command Line. Follow along with the instructions on that site if you want to get it set up for your latest project. Go ahead, I'll wait…</p>
<p>…Okay great, you're back! Now let's begin with one really dead easy trick to keep your configuration files working on both sides, without having to change them every time you commit many site changes.</p>
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showPlainTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">"REMOTE_ADDR"</span><span style="color:#006600; font-weight:bold;">]</span> == <span style="color:#FF0000;">"127.0.0.1"</span><span style="color:#006600; font-weight:bold;">)</span> <span style="color:#006600; font-weight:bold;">{</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#0000FF;">$l</span> = <a href="http://www.php.net/mysql_connect"><span style="color:#000066;">mysql_connect</span></a> <span style="color:#006600; font-weight:bold;">(</span> <span style="color:#FF0000;">"localhost"</span> , <span style="color:#FF0000;">"root"</span> , <span style="color:#FF0000;">""</span> <span style="color:#006600; font-weight:bold;">)</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#FF0000;">"Error connecting: &lt;br /&gt;&lt;br /&gt;"</span>.<a href="http://www.php.net/mysql_error"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <a href="http://www.php.net/mysql_select_db"><span style="color:#000066;">mysql_select_db</span></a><span style="color:#006600; font-weight:bold;">(</span> <span style="color:#FF0000;">"stardup"</span> <span style="color:#006600; font-weight:bold;">)</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#FF0000;">"Error getting db: &lt;br /&gt;&lt;br /&gt;"</span>.<a href="http://www.php.net/mysql_error"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    </div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#0000FF;">$siteurl</span> = <span style="color:#FF0000;">"http://stardup.dev/"</span>; <span style="color:#FF9933; font-style:italic;">// WITH TRAILING SLASH!</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">{</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#0000FF;">$l</span> = <a href="http://www.php.net/mysql_connect"><span style="color:#000066;">mysql_connect</span></a> <span style="color:#006600; font-weight:bold;">(</span> <span style="color:#FF0000;">"localhost"</span> , <span style="color:#FF0000;">"stardup_user"</span> , <span style="color:#FF0000;">"**********"</span> <span style="color:#006600; font-weight:bold;">)</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#FF0000;">"Error connecting: &lt;br /&gt;&lt;br /&gt;"</span>.<a href="http://www.php.net/mysql_error"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <a href="http://www.php.net/mysql_select_db"><span style="color:#000066;">mysql_select_db</span></a><span style="color:#006600; font-weight:bold;">(</span> <span style="color:#FF0000;">"stardup"</span> <span style="color:#006600; font-weight:bold;">)</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#FF0000;">"Error getting db: &lt;br /&gt;&lt;br /&gt;"</span>.<a href="http://www.php.net/mysql_error"><span style="color:#000066;">mysql_error</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#0000FF;">$siteurl</span> = <span style="color:#FF0000;">"http://stardup.com/"</span>; <span style="color:#FF9933; font-style:italic;">// WITH TRAILING SLASH!</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This can be done in any other programming language, however the if/else syntax changes a bit. I've also begun taking this a little further, including other bits in my code like $header and $footer stuff that will help me visually determine which one I may be looking at (as I'm often too lazy to look at the address bar).</p>
<p>So my next tip is related to running a lightweight version of XAMPP (because you really don't need all of the features for local development). I write a very simple Applescript that launches XAMPP with options, and then placed it in my System Preferences &gt; Accounts &gt; My Account &gt; Login Items</p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do shell script <span style="color:#CC0000;">"/Applications/XAMPP/xamppfiles/xampp startapache"</span> user name <span style="color:#CC0000;">"yourname"</span> password <span style="color:#CC0000;">"yourpassword"</span> with administrator privileges</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do shell script <span style="color:#CC0000;">"/Applications/XAMPP/xamppfiles/xampp startmysql"</span> user name <span style="color:#CC0000;">"yourname"</span> password <span style="color:#CC0000;">"yourpassword"</span> with administrator privileges </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now I know a lot of the more hardcore programmers are probably wondering why I have to do the username/pass with administrator privileges twice, the answer is because I know only as much Applescript as I need to, and nothing more.</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F&amp;t=Tips%20on%20Local%20Development" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F&amp;title=Tips%20on%20Local%20Development" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F&amp;title=Tips%20on%20Local%20Development&amp;notes=Okay%2C%20so%20I%27ve%20posted%20before%20about%20MAMP%2C%20XAMPP%20and%20the%20alternatives%20but%20now%20I%27m%20going%20to%20dig%20a%20bit%20deeper%20into%20tricks%20and%20tips.%20Bear%20in%20mind%20that%20I%27m%20writing%20this%20on%20how%20I%20do%20my%20development%20and%20your%20software%20choices%20and%20the%20like%20may%20be%20somewhat%20differ" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F&amp;title=Tips%20on%20Local%20Development" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2010%2Fworkflow%2Ftips-on-local-development%2F&amp;title=Tips%20on%20Local%20Development&amp;bodytext=Okay%2C%20so%20I%27ve%20posted%20before%20about%20MAMP%2C%20XAMPP%20and%20the%20alternatives%20but%20now%20I%27m%20going%20to%20dig%20a%20bit%20deeper%20into%20tricks%20and%20tips.%20Bear%20in%20mind%20that%20I%27m%20writing%20this%20on%20how%20I%20do%20my%20development%20and%20your%20software%20choices%20and%20the%20like%20may%20be%20somewhat%20differ" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2010/workflow/tips-on-local-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Local Development using MAMP</title>
		<link>http://www.mediaextra.net/2009/workflow/local-dev-using-mamp/</link>
		<comments>http://www.mediaextra.net/2009/workflow/local-dev-using-mamp/#comments</comments>
		<pubDate>Sun, 03 May 2009 06:17:36 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[Mac Software]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/?p=44</guid>
		<description><![CDATA[When I'm developing a Web site sometimes I will take my initial development local and run a local server. Obviously for projects already online or projects that do not require full database integration I do not need to run one all of the time. This is where MAMP comes into play, or if you run [...]]]></description>
			<content:encoded><![CDATA[<p>When I'm developing a Web site sometimes I will take my initial development local and run a local server. Obviously for projects already online or projects that do not require full database integration I do not need to run one all of the time. This is where <a href="http://www.mamp.info/">MAMP</a> comes into play, or if you run Windows <a href="http://www.wampserver.com/en/">WAMP</a>* would be your flavor.</p>
<p>What exactly do these terms mean? The <strong>M</strong> and <strong>W</strong> stand for your working platform by way of Macintosh or Windows and the <acronym title="Apache, MySQL and PHP">AMP</acronym> stands for Apache, MySQL and PHP. These simple apps can start and stop the full suite of hosting tools at a moments notice without you having to muck around in your system and install all sorts of tools that require more in depth configuration. I've found that overall this can speed up programming and testing because you will not need to constantly upload files to an FTP server and check them that way, instead you would just save and refresh your browser.</p>
<p>And it would be sort of open-source blasphemy if I didn't mention XAMPP mainly used for Linux, but also containing flavors of Mac OS X, Windows and even Solaris.</p>
<p>All of these software packages are free, or have a free (lite) version available for you to use in your programming endeavors so have at it!</p>
<p><em style="font-size:10px;">*Windows &amp; WAMP makes the assumption that you are developing a PHP/MySQL Web site and not a .NET Solution</em></p>
<p><strong>Update:</strong> I have moved from MAMP to XAMPP for local development, it's a little more flexible for my usage.</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F&amp;t=Local%20Development%20using%20MAMP" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F&amp;title=Local%20Development%20using%20MAMP" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F&amp;title=Local%20Development%20using%20MAMP&amp;notes=When%20I%27m%20developing%20a%20Web%20site%20sometimes%20I%20will%20take%20my%20initial%20development%20local%20and%20run%20a%20local%20server.%20Obviously%20for%20projects%20already%20online%20or%20projects%20that%20do%20not%20require%20full%20database%20integration%20I%20do%20not%20need%20to%20run%20one%20all%20of%20the%20time.%20This%20i" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F&amp;title=Local%20Development%20using%20MAMP" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2009%2Fworkflow%2Flocal-dev-using-mamp%2F&amp;title=Local%20Development%20using%20MAMP&amp;bodytext=When%20I%27m%20developing%20a%20Web%20site%20sometimes%20I%20will%20take%20my%20initial%20development%20local%20and%20run%20a%20local%20server.%20Obviously%20for%20projects%20already%20online%20or%20projects%20that%20do%20not%20require%20full%20database%20integration%20I%20do%20not%20need%20to%20run%20one%20all%20of%20the%20time.%20This%20i" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2009/workflow/local-dev-using-mamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy PHP contact form, with gotcha!</title>
		<link>http://www.mediaextra.net/2008/scripting/php/easy-php-contact-form-gotcha/</link>
		<comments>http://www.mediaextra.net/2008/scripting/php/easy-php-contact-form-gotcha/#comments</comments>
		<pubDate>Mon, 19 May 2008 22:19:42 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[$_POST]]></category>
		<category><![CDATA[contact form]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[isset]]></category>
		<category><![CDATA[spam prevention]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/?p=19</guid>
		<description><![CDATA[Yes that's right, I called it Gotcha. So why Gotcha? Simple really, it's not as involved as a Captcha (also not as secure but will fend off most spambots). Below I have written a very simple Contact form in PHP, I will explain the goods right after the form.
Okay, let's take a step through this [...]]]></description>
			<content:encoded><![CDATA[<p>Yes that's right, I called it Gotcha. So why Gotcha? Simple really, it's not as involved as a Captcha (also not as secure but will fend off most spambots). Below I have written a very simple Contact form in PHP, I will explain the goods right after the form.<span id="more-19"></span></p>
<p>Okay, let's take a step through this method. First off is the <strong>if(isset($_POST['submit']))</strong>, all that really does it tell the page to run the mail and spam checking functions if the user submitted the form. Then it gets the POST methods from the submission and we set the variables.</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showPlainTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">(</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'submit'</span><span style="color:#006600; font-weight:bold;">]</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">{</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$name</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'name'</span><span style="color:#006600; font-weight:bold;">]</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$email</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'email'</span><span style="color:#006600; font-weight:bold;">]</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$stuff</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'stuff'</span><span style="color:#006600; font-weight:bold;">]</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$human</span> = <span style="color:#0000FF;">$_POST</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'human'</span><span style="color:#006600; font-weight:bold;">]</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>if ($human != "123") {</strong> business checks that the user is not a spambot.</p>
<p>In this case <strong>ABC is easy as 123</strong>, so if the user doesn't type in 123 it will alert them and send them back to the previous page (I hate to click a back button, so I took that step out). If they do answer <strong>123</strong> the script will hit the next block, which is a basic PHP mail function. If they did not it alerts them and sends a history.back(1) script so they can take another whack at it.</p>
<div class="igBar"><span id="lphp-10"><a href="#" onclick="javascript:showPlainTxt('php-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-10">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$human</span> != <span style="color:#FF0000;">"123"</span><span style="color:#006600; font-weight:bold;">)</span> <span style="color:#006600; font-weight:bold;">{</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;script&gt;alert('Whoa $name you either answered the last question wrong, or forgot to answer at all!');"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;/script&gt;&lt;script&gt;history.back(1)&lt;/script&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/exit"><span style="color:#000066;">exit</span></a>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If the user did answer the secret question correctly, the script can move onto the next step. In this step the users comments will be sent to you. So I set a variable for your email (in this example you@yourdomain.com, pretty basic I know). Then the subject and message body. Tip, you can inject the variables from the first step into your subject and message, in fact you need to somewhere or you won't get any info. You do this by using the $name, $email, etc.</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$to_email</span> = <span style="color:#FF0000;">"you@yourdomain.com"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$subject</span> = <span style="color:#FF0000;">"$name wanted to tell you something"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$msg</span> = <span style="color:#FF0000;">"$name wanted to let you know $stuff&lt;br /&gt;Email them at &lt;a href='mailto:$email'&gt;$email&lt;/a&gt; to answer!"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$mailheaders</span> = <span style="color:#FF0000;">"From:  $email<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$mailheaders</span> .= <span style="color:#FF0000;">"Reply-To:  $email<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$mailheaders</span> .= <span style="color:#FF0000;">"Return-Path: $email<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$mailheaders</span> .= <span style="color:#FF0000;">"Content-type: text/html<span style="color:#000099; font-weight:bold;">\n</span><span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/mail"><span style="color:#000066;">mail</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$to_email</span>, <span style="color:#0000FF;">$subject</span>, <span style="color:#0000FF;">$msg</span>, <span style="color:#0000FF;">$mailheaders</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"&lt;script&gt;alert('Thanks for taking the time to contact me, $name I will get back to you as soon as possible!');&lt;/script&gt;"</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;script&gt;location.replace("/")&lt;/script&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <a href="http://www.php.net/exit"><span style="color:#000066;">exit</span></a>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">{</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Cool, the form was sent and the user was informed of their success, and then sent to the site root. The <strong>} else {</strong> is fairly important, without this nothing will show up for the user to fill out.</p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$form</span> = <span style="color:#FF0000;">'&lt;form action="'</span>.<span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">[</span><span style="color:#FF0000;">'PHP_SELF'</span><span style="color:#006600; font-weight:bold;">]</span>.<span style="color:#FF0000;">'" method="post"&gt;'</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$form</span> .= <span style="color:#FF0000;">'And you are?&lt;br /&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    &lt;input type="text" name="name" id="name" /&gt;&lt;br /&gt; </span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    I can email you where?&lt;br /&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    &lt;input type="text" name="email" id="email" /&gt;&lt;br /&gt;</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    You<span style="color:#000099; font-weight:bold;">\'</span>d like to tell me?&lt;br /&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    &lt;textarea name="stuff" id="stuff"&gt;&lt;/textarea&gt;&lt;br /&gt;</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    ABC is easy as &lt;input type="text" name="human" id="human" size="3" /&gt; (&lt;em&gt;According to the Jackson 5&lt;/em&gt;)&lt;br /&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">    &lt;input name="submit" type="submit" value="Tell Me Something Good!" /&gt;</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&lt;/form&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$form</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lastly, do not forget to put your <strong>}</strong> before the end of the script, I say that because I sometimes forget that.</p>
<p>So that's it, if you want to download this script for reference <a href="http://stardup.com/urls/gotcha_php/">click here</a> If you just copy and paste the highlighted code you'll have to replace all ' with the proper single ticks.</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F&amp;t=Easy%20PHP%20contact%20form%2C%20with%20gotcha%21" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F&amp;title=Easy%20PHP%20contact%20form%2C%20with%20gotcha%21" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F&amp;title=Easy%20PHP%20contact%20form%2C%20with%20gotcha%21&amp;notes=Yes%20that%27s%20right%2C%20I%20called%20it%20Gotcha.%20So%20why%20Gotcha%3F%20Simple%20really%2C%20it%27s%20not%20as%20involved%20as%20a%20Captcha%20%28also%20not%20as%20secure%20but%20will%20fend%20off%20most%20spambots%29.%20Below%20I%20have%20written%20a%20very%20simple%20Contact%20form%20in%20PHP%2C%20I%20will%20explain%20the%20goods%20right%20after%20t" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F&amp;title=Easy%20PHP%20contact%20form%2C%20with%20gotcha%21" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Feasy-php-contact-form-gotcha%2F&amp;title=Easy%20PHP%20contact%20form%2C%20with%20gotcha%21&amp;bodytext=Yes%20that%27s%20right%2C%20I%20called%20it%20Gotcha.%20So%20why%20Gotcha%3F%20Simple%20really%2C%20it%27s%20not%20as%20involved%20as%20a%20Captcha%20%28also%20not%20as%20secure%20but%20will%20fend%20off%20most%20spambots%29.%20Below%20I%20have%20written%20a%20very%20simple%20Contact%20form%20in%20PHP%2C%20I%20will%20explain%20the%20goods%20right%20after%20t" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2008/scripting/php/easy-php-contact-form-gotcha/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Dynamic Image Gallery using PHP</title>
		<link>http://www.mediaextra.net/2008/scripting/php/simple-dynamic-image-gallery-using-php/</link>
		<comments>http://www.mediaextra.net/2008/scripting/php/simple-dynamic-image-gallery-using-php/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 00:29:29 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/2008/simple-dynamic-image-gallery-using-php/</guid>
		<description><![CDATA[So often you may want to show a little gallery of photos on your blog or website, you have a few choices out there. Choice one would be to just do a down and dirty bit of html, &#60;img src=" etc etc or you could go with a program that creates galleries. Those usually don't [...]]]></description>
			<content:encoded><![CDATA[<p>So often you may want to show a little gallery of photos on your blog or website, you have a few choices out there. Choice one would be to just do a down and dirty bit of html, &lt;img src=" etc etc or you could go with a program that creates galleries. Those usually don't integrate with a site too well, and often are overkill for showing the world your new car, puppy or dinner entrees.</p>
<p>Luckily if you have your FTP program and a few pics handy you can just traverse your directories and spit out the files in code. This can be handy for swapping the files around and even adding more down the road, it will dynamically expand the gallery.</p>
<div class="igBar"><span id="lphp-15"><a href="#" onclick="javascript:showPlainTxt('php-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-15">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$path</span> = <span style="color:#FF0000;">"/home/user/public/foldername/"</span>; <span style="color:#FF9933; font-style:italic;">//path from root</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#0000FF;">$dir_handle</span> = @<a href="http://www.php.net/opendir"><span style="color:#000066;">opendir</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">)</span> or <a href="http://www.php.net/die"><span style="color:#000066;">die</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#FF0000;">"Unable to open $path"</span><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$file</span> = <a href="http://www.php.net/readdir"><span style="color:#000066;">readdir</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$dir_handle</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span> <span style="color:#006600; font-weight:bold;">{</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$file</span> == <span style="color:#FF0000;">"."</span> || <span style="color:#0000FF;">$file</span> == <span style="color:#FF0000;">".."</span> || <span style="color:#0000FF;">$file</span> == <span style="color:#FF0000;">"index.php"</span> <span style="color:#006600; font-weight:bold;">)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color:#616100;">continue</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;img src="$file" /&gt;&lt;br /&gt;'</span>; <span style="color:#FF9933; font-style:italic;">//formatting this is up to you</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">}</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/closedir"><span style="color:#000066;">closedir</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$dir_handle</span><span style="color:#006600; font-weight:bold;">)</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you want to be slick, make thumbnails with the same name, but tag like tn_ before the image name and put them in another folder, this will allow you to call something like this:</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showPlainTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'&lt;a href="$file"&gt;&lt;img src="otherfolder/tn_$file" /&gt;&lt;/a&gt;&lt;br /&gt;'</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Note:</strong> This will also work for files, you can add options to filter only images if you'd like.</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F&amp;t=Simple%20Dynamic%20Image%20Gallery%20using%20PHP" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F&amp;title=Simple%20Dynamic%20Image%20Gallery%20using%20PHP" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F&amp;title=Simple%20Dynamic%20Image%20Gallery%20using%20PHP&amp;notes=So%20often%20you%20may%20want%20to%20show%20a%20little%20gallery%20of%20photos%20on%20your%20blog%20or%20website%2C%20you%20have%20a%20few%20choices%20out%20there.%20Choice%20one%20would%20be%20to%20just%20do%20a%20down%20and%20dirty%20bit%20of%20html%2C%20%26lt%3Bimg%20src%3D%22%20etc%20etc%20or%20you%20could%20go%20with%20a%20program%20that%20creates%20galleri" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F&amp;title=Simple%20Dynamic%20Image%20Gallery%20using%20PHP" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fsimple-dynamic-image-gallery-using-php%2F&amp;title=Simple%20Dynamic%20Image%20Gallery%20using%20PHP&amp;bodytext=So%20often%20you%20may%20want%20to%20show%20a%20little%20gallery%20of%20photos%20on%20your%20blog%20or%20website%2C%20you%20have%20a%20few%20choices%20out%20there.%20Choice%20one%20would%20be%20to%20just%20do%20a%20down%20and%20dirty%20bit%20of%20html%2C%20%26lt%3Bimg%20src%3D%22%20etc%20etc%20or%20you%20could%20go%20with%20a%20program%20that%20creates%20galleri" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2008/scripting/php/simple-dynamic-image-gallery-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Trick for Bloated OpenSource Software</title>
		<link>http://www.mediaextra.net/2008/scripting/php/php-trick-for-bloated-opensource/</link>
		<comments>http://www.mediaextra.net/2008/scripting/php/php-trick-for-bloated-opensource/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 05:52:52 +0000</pubDate>
		<dc:creator>Jack Keller</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://www.mediaextra.net/2008/php-trick-for-bloated-opensource/</guid>
		<description><![CDATA[If your anything like me nothing is great until you’ve hacked it apart. However with OpenSource software many times your hacks and mods will be overwritten every time you upgrade to the latest and greatest. So how can one combat this task with little to no hacks?
First off let me say that I’m not knocking [...]]]></description>
			<content:encoded><![CDATA[<p>If your anything like me nothing is great until you’ve hacked it apart. However with OpenSource software many times your hacks and mods will be overwritten every time you upgrade to the latest and greatest. So how can one combat this task with little to no hacks?</p>
<p>First off let me say that I’m not knocking any software here, I know that people pour hours and hours of their heart and soul into building something that can be used by nearly anybody. But as a seasoned designer I have to gripe about CSS bloat, it’s everywhere, tags nested ten to twenty levels deep sometimes.</p>
<p>So if you're using PHP, you can always do what I’ve done using the <strong>ob_start</strong> method (in fact it’s how I’m building the Acronyms for this site currently).</p>
<p>So if you want to change a few things around, this is a pretty good method to help you avoid hacking core files to an OpenSource application. The code below is what you want to place before your file starts, or your content area if you’re just looking to change some wording.</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/ob_start"><span style="color:#000066;">ob_start</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<blockquote><p>This site was built using the Wordpress CMS and carefully loved with CSS for your viewing pleasure.</p></blockquote>
<div class="igBar"><span id="lphp-20"><a href="#" onclick="javascript:showPlainTxt('php-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-20">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// set up an array of words you want to find, then replace</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$mainnormal</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">(</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">’ CSS ‘,</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">’ CMS ‘,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$maincustom</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">(</span></div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">’ &lt;acronym title=<span style="color:#FF0000;">"Cascading Style Sheets"</span>&gt;CSS&lt;/acronym&gt; ‘,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">’ &lt;acronym title=<span style="color:#FF0000;">"Content Management System"</span>&gt;CMS&lt;/acronym&gt; ‘,</div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">)</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#444444;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div>
</li>
<li style="font-weight: bold;color:#D7D7D7;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <a href="http://www.php.net/str_replace"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#0000FF;">$mainnormal</span>,<span style="color:#0000FF;">$maincustom</span>,<a href="http://www.php.net/ob_get_clean"><span style="color:#000066;">ob_get_clean</span></a><span style="color:#006600; font-weight:bold;">(</span><span style="color:#006600; font-weight:bold;">)</span><span style="color:#006600; font-weight:bold;">)</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Simple array in place, if you were only going to replace one word on the site you could just surround it with quotes and put it into the echo str_replace function, I find this useful to help remove extra classes and ID’s unnecessary to a CMS, makes my job easier as a designer to keep the Stylesheet well formed.</p>

<div class="sociable">
<div class="sociable_tagline">
Share?
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F&amp;t=PHP%20Trick%20for%20Bloated%20OpenSource%20Software" title="Facebook"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.designfloat.com/submit.php?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F&amp;title=PHP%20Trick%20for%20Bloated%20OpenSource%20Software" title="Design Float"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/designfloat.png" title="Design Float" alt="Design Float" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F&amp;title=PHP%20Trick%20for%20Bloated%20OpenSource%20Software&amp;notes=If%20your%20anything%20like%20me%20nothing%20is%20great%20until%20you%E2%80%99ve%20hacked%20it%20apart.%20However%20with%20OpenSource%20software%20many%20times%20your%20hacks%20and%20mods%20will%20be%20overwritten%20every%20time%20you%20upgrade%20to%20the%20latest%20and%20greatest.%20So%20how%20can%20one%20combat%20this%20task%20with%20litt" title="del.icio.us"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F&amp;title=PHP%20Trick%20for%20Bloated%20OpenSource%20Software" title="StumbleUpon"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F" title="Technorati"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mediaextra.net%2F2008%2Fscripting%2Fphp%2Fphp-trick-for-bloated-opensource%2F&amp;title=PHP%20Trick%20for%20Bloated%20OpenSource%20Software&amp;bodytext=If%20your%20anything%20like%20me%20nothing%20is%20great%20until%20you%E2%80%99ve%20hacked%20it%20apart.%20However%20with%20OpenSource%20software%20many%20times%20your%20hacks%20and%20mods%20will%20be%20overwritten%20every%20time%20you%20upgrade%20to%20the%20latest%20and%20greatest.%20So%20how%20can%20one%20combat%20this%20task%20with%20litt" title="Digg"><img src="http://www.mediaextra.net/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.mediaextra.net/2008/scripting/php/php-trick-for-bloated-opensource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
