<?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>html tutorials &#124; css tutorials &#124; php tutorials &#124; Nodstrum Blog &#187; General</title>
	<atom:link href="http://www.nodstrum.com/category/general/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nodstrum.com</link>
	<description>A coders playground.</description>
	<lastBuildDate>Tue, 04 May 2010 22:12:43 +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>Creating an Effective call to action</title>
		<link>http://www.nodstrum.com/2010/05/01/creating-an-effective-call-to-action/</link>
		<comments>http://www.nodstrum.com/2010/05/01/creating-an-effective-call-to-action/#comments</comments>
		<pubDate>Sat, 01 May 2010 15:58:20 +0000</pubDate>
		<dc:creator>jaybaron</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.nodstrum.com/?p=159</guid>
		<description><![CDATA[Having an effective call to action is an important part of any professional website design.  There is obviously a goal to every website whether that is getting emails for your newsletter or getting someone to download an item.  Making sure you have an effective call to action is essential to the success of [...]]]></description>
			<content:encoded><![CDATA[<p>Having an effective call to action is an important part of any professional <a href="http://www.madtowndesigns.com/">website design</a>.  There is obviously a goal to every website whether that is getting emails for your newsletter or getting someone to download an item.  Making sure you have an effective call to action is essential to the success of your website.</p>
<p>How then do you lay the round work for an effective call to action.  Here are some simple techniques that if implemented will surely help your conversion rate.</p>
<p><strong>Create Urgency:<br />
</strong><br />
Probably the most important aspect of any call to action is urgency.  If there is no urgency your customer will not do the designated action as there is no immediate need.</p>
<p>So how do we create urgency?  There are numerous ways to do this some of them include phrases such as “act now” or “try today for free”.  Make sure the action creates urgency and makes them take immediate action.  Which is better “sign up” or “sign up now”.</p>
<p><strong>Positioning and Consistency:</strong></p>
<p>Make sure your call to action is positioned properly.  Ideally you want it towards the top of the page and make it one of the first things that your clients see every time.  Generally, most visitors eyes start on the left side of the screen.  In addition, make your call to action consistent it should be in the same position, same color, and same button on every page.</p>
<p><strong>Create a Win-Win situation:</strong></p>
<p>Of course you want to benefit, but make sure that the visitor will benefit as well.  Making it a win-win situation will just result in a higher conversion rate don&#8217;t forget about your customers.</p>
<p><strong>Don&#8217;t forget about everyone else:</strong></p>
<p>Although your ultimate goal is to convert users don&#8217;t forget about your non-converting customers.  Don&#8217;t make your call to action get in the way of the information on your website.  It is important to make sure that the user experience is still pleasant as a whole.  The more information you provide the more trust the user will put in you and will ultimately result in a conversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2010/05/01/creating-an-effective-call-to-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m Back!  Follow Me</title>
		<link>http://www.nodstrum.com/2010/04/21/im-back-follow-me/</link>
		<comments>http://www.nodstrum.com/2010/04/21/im-back-follow-me/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 15:44:15 +0000</pubDate>
		<dc:creator>jaybaron</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.nodstrum.com/?p=157</guid>
		<description><![CDATA[I have not posted in awhile but I&#8217;m back and plan on posting again.  Please follow me on twitter and as I add new articles and posts I will let you all know!  Twitter
]]></description>
			<content:encoded><![CDATA[<p>I have not posted in awhile but I&#8217;m back and plan on posting again.  Please follow me on twitter and as I add new articles and posts I will let you all know!  <a href="http://twitter.com/MadTownDesigns">Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2010/04/21/im-back-follow-me/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mod_Rewrite and PHP Tutorial</title>
		<link>http://www.nodstrum.com/2009/12/30/mod_rewrite-and-php-tutorial/</link>
		<comments>http://www.nodstrum.com/2009/12/30/mod_rewrite-and-php-tutorial/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:23:08 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=58</guid>
		<description><![CDATA[I have been playing around with Apaches mod_rewrite on my other site http://www.2big2send.com and i must admit its a whole lot easier than i first thought..
Here is a quick guide for most general use:
Create a new file in your main directory (public_html for cPanel or httpdocs for plesk &#8211; not sure about other ones) called [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with Apaches mod_rewrite on my other site <a href="http://www.2big2send.com">http://www.2big2send.com</a> and i must admit its a whole lot easier than i first thought..</p>
<p>Here is a quick guide for most general use:</p>
<p>Create a new file in your main directory (public_html for cPanel or httpdocs for plesk &#8211; not sure about other ones) called .htaccess (Dont forget the &#8216;.&#8217; dot before the name &#8211; you may already have one of these file, thats ok, just edit it and follow the guide below.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">RewriteEngine</span> <span class="kw2">On</span><br />
<span class="co1"># Check if the file or directory actually exists &#8211; if it does we dont want to redirect</span><br />
<span class="kw1">RewriteCond</span> %<span class="br0">&#123;</span>REQUEST_FILENAME<span class="br0">&#125;</span> !-f<br />
<span class="kw1">RewriteCond</span> %<span class="br0">&#123;</span>REQUEST_FILENAME<span class="br0">&#125;</span> !-d<br />
<span class="co1"># Pass the rewritten URL onto index.php with a $_GET['url'] parameter</span><br />
<span class="kw1">RewriteRule</span> ^<span class="br0">&#40;</span>.*<span class="br0">&#41;</span>$ index.php?url=$<span class="nu0">1</span> <span class="br0">&#91;</span>PT,L<span class="br0">&#93;</span></div>
<p>What the above Apache code does is firstly check the actual URL and ensure that is it not a file or directory, that actually exists.<br />
Then it passes the request onto index.php for handling</p>
<p>Here is the index.php code with the handler</p>
<div class="dean_ch" style="white-space: wrap;"> &nbsp; &nbsp;<span class="kw2">function</span> handleRequest<span class="br0">&#40;</span><span class="re0">$urlString</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$url</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Split apart the URL String on the forward slashes.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$url</span> = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&#8216;/&#8217;</span>, <span class="re0">$urlString</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">switch</span><span class="br0">&#40;</span><span class="re0">$url</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8216;home&#8217;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include_once</span><span class="br0">&#40;</span><span class="st0">&#8216;home.php&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&#8216;news&#8217;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include_once</span><span class="br0">&#40;</span><span class="st0">&#8216;news.php&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">default</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include_once</span><span class="br0">&#40;</span><span class="st0">&#8216;home.php&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span></p>
<p>&nbsp; &nbsp; <span class="re0">$incommingURL</span> = <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st0">&#8216;url&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> ? <span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st0">&#8216;url&#8217;</span><span class="br0">&#93;</span> : <span class="st0">&#8221;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; handleRequest<span class="br0">&#40;</span><span class="re0">$incommingURL</span><span class="br0">&#41;</span>;</div>
<p>So&#8230; The handleRequest function takes in the URL GET parameter we setup in the .htaccess file.<br />
We split that apart on the forward slashes so it can be easily expanded.<br />
I have assumes that the first part of the URL will be the base page; so for example: http://www.domain.com/home will cause the home.php page to be included.<br />
If the URL was  http://www.domain.com/news/page-1 then the news.php page would be included, and then you would do some processing on the news.php page to handle the /page-1 part of the URL ($url[1]).</p>
<p>Here is the part you are most interested in &#8211; the</p>
<h3><a href="http://www.nodstrum.com/wp-content/plugins/DownloadCounter/download.php?id=32">Mod_Rewrite and PHP Demo</a></h3>
<p>and</p>
<h3><a href="http://www.nodstrum.com/wp-content/plugins/DownloadCounter/download.php?id=31">Mod_Rewrite.zip Download</a></h3>
<p>There are a few Gotchas that I found; the main one being that you must edit your <strong>httpd.conf</strong> file, you will find a <strong>&lt;Directory /&gt;</strong> part where <strong>AllowOverride None</strong> is listed &#8211; you <strong><em>MUST</em><span style="font-weight: normal;"> change this part to </span>AllowOverride All</strong> or mod_rewrite will not work.<br />
There are others &#8211; but i will have to answer them as you come across them as i cant remember off the top of my head.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2009/12/30/mod_rewrite-and-php-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Twitter &#8211; Ask Me Your Programing Questions</title>
		<link>http://www.nodstrum.com/2009/02/25/twitter-ask-me-your-programing-questions/</link>
		<comments>http://www.nodstrum.com/2009/02/25/twitter-ask-me-your-programing-questions/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 10:08:41 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=109</guid>
		<description><![CDATA[Hi Everyone!
Its been aaaaaggggggeeeeeessssss since i posted anything up here, i&#8217;ve been up to my eyes with work and other things!
I noticed that alot of you are asking questions that could be answered and shared to the Entire Twitter Community! So i setup a Twitter Feed &#8211; feel free to ask me your programming questions http://twitter.com/nodstrum
]]></description>
			<content:encoded><![CDATA[<p>Hi Everyone!</p>
<p>Its been aaaaaggggggeeeeeessssss since i posted anything up here, i&#8217;ve been up to my eyes with work and other things!</p>
<p>I noticed that alot of you are asking questions that could be answered and shared to the Entire Twitter Community! So i setup a Twitter Feed &#8211; feel free to ask me your programming questions <a href="https://twitter.com/nodstrum">http://twitter.com/nodstrum</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2009/02/25/twitter-ask-me-your-programing-questions/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Mona Lisa in 80ms</title>
		<link>http://www.nodstrum.com/2008/08/29/mona-lisa-in-80ms/</link>
		<comments>http://www.nodstrum.com/2008/08/29/mona-lisa-in-80ms/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 10:50:34 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=94</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/fKK933KK6Gg&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/fKK933KK6Gg&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/08/29/mona-lisa-in-80ms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Dalek</title>
		<link>http://www.nodstrum.com/2008/08/19/iphone-dalek/</link>
		<comments>http://www.nodstrum.com/2008/08/19/iphone-dalek/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 08:36:43 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=85</guid>
		<description><![CDATA[iPhone Telescope or Cleverly Disguised Dalek

Found on Engadget
You can buy one here http://mobile.brando.com.hk/prod_detail.php?prod_id=03534
]]></description>
			<content:encoded><![CDATA[<p>iPhone Telescope or Cleverly Disguised Dalek</p>
<p><a href="http://nodstrum.com/wp-content/uploads/2008/08/mtlsc003300_01_l.jpg"><img class="alignnone size-full wp-image-86" title="mtlsc003300_01_l" src="http://nodstrum.com/wp-content/uploads/2008/08/mtlsc003300_01_l.jpg" alt="" width="500" height="375" /></a></p>
<p>Found on <a href="http://www.engadget.com/2008/08/18/brando-telescope-makes-iphone-3g-photos-6x-worse/" target="_blank">Engadget</a></p>
<p>You can buy one here <a href="http://mobile.brando.com.hk/prod_detail.php?prod_id=03534" target="_blank">http://mobile.brando.com.hk/prod_detail.php?prod_id=03534</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/08/19/iphone-dalek/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pink box testing</title>
		<link>http://www.nodstrum.com/2008/08/13/pink-box-testing/</link>
		<comments>http://www.nodstrum.com/2008/08/13/pink-box-testing/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 06:41:42 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=76</guid>
		<description><![CDATA[From: http://neilbowers.wordpress.com/2008/08/11/pink-box-testing/
Pink box testing
Some years ago I was in a job where I needed to bring in a lot of software contractors in a short space of time. As a result I ended up dealing with a good number of IT contracting agencies. To help the process I wrote very specific job / task descriptions, [...]]]></description>
			<content:encoded><![CDATA[<p>From: http://neilbowers.wordpress.com/2008/08/11/pink-box-testing/</p>
<blockquote><p>Pink box testing</p>
<p>Some years ago I was in a job where I needed to bring in a lot of software contractors in a short space of time. As a result I ended up dealing with a good number of IT contracting agencies. To help the process I wrote very specific job / task descriptions, and sent these to all agencies.</p>
<p>Generally I would receive agency-specific CVs, where they had reformatted the candidate’s CV, and in places tweaked the content. Over time it became clear that some agencies certainly did a lot more than reformatting, adding things they thought I wanted to see. This was really annoying, as the fabrication would reveal itself at some point in the process, sometimes after wasting time on a candidate.</p>
<p>We needed a software tester, and while writing the task description I decided to see how far the agencies would go. The descriptions all had a section listing required skills and experience, and another listing desirables. In the required section I listed “Pink box testing experience”. There’s no such thing as Pink box testing &#8211; I made it up to see if I received any CVs with pink box testing listed.</p>
<p>Sure enough, a week or so after putting out the description, I received a CV for a software tester. He clearly had a lot of relevant experience, but the agency had added pink box testing as one of his strengths. It was fun ringing up the agent and explaining that he’d been caught in my trap, and listening to him trying to weasel his way out.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/08/13/pink-box-testing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Retro [PIC]</title>
		<link>http://www.nodstrum.com/2008/08/01/retro-pic/</link>
		<comments>http://www.nodstrum.com/2008/08/01/retro-pic/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 08:49:29 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/2008/08/01/retro-pic/</guid>
		<description><![CDATA[When was the last time you saw one of these?!read more &#124; digg story
]]></description>
			<content:encoded><![CDATA[<p>When was the last time you saw one of these?!<br/><br/><a href="http://www.2big2send.com/view/MjQxMHx2aWV3ZXJ8MTIxNzU3NzE3OQ==">read more</a> | <a href="http://digg.com/comedy/Retro_PIC">digg story</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/08/01/retro-pic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This will mess with your head!</title>
		<link>http://www.nodstrum.com/2008/07/21/this-will-mess-with-your-head/</link>
		<comments>http://www.nodstrum.com/2008/07/21/this-will-mess-with-your-head/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 09:04:11 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://nodstrum.com/?p=71</guid>
		<description><![CDATA[Ever had a good look at the FedEx Logo?? I guarantee you won&#8217;t see it the same again after mousing over the logo below.
Put your mouse over the logo below.



See the Arrow?? Now enjoy haveing your eyes always trying to focus on it in the future.
Sorry  
Jamie.
]]></description>
			<content:encoded><![CDATA[<p>Ever had a good look at the FedEx Logo?? I guarantee you won&#8217;t see it the same again after mousing over the logo below.</p>
<p><strong>Put your mouse over the logo below.</strong></p>
<p>
<img src="http://www.nodstrum.com/images/fedex_before.png" alt="FedEx Logo" onMouseOver="this.src='http://www.nodstrum.com/images/fedex_after.png';" onMouseOut="this.src='http://www.nodstrum.com/images/fedex_before.png';">
</p>
<p><em>See the Arrow?? Now enjoy haveing your eyes always trying to focus on it in the future.</em></p>
<p>Sorry <img src='http://www.nodstrum.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Jamie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/07/21/this-will-mess-with-your-head/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Shorthand PHP IF/ELSE Statements = much shorter code!</title>
		<link>http://www.nodstrum.com/2008/02/14/shorthand-php-ifelse-statements-much-shorter-code/</link>
		<comments>http://www.nodstrum.com/2008/02/14/shorthand-php-ifelse-statements-much-shorter-code/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 11:27:47 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://nodstrum.com/2008/02/14/shorthand-php-ifelse-statements-much-shorter-code/</guid>
		<description><![CDATA[You may or may not have heard of shorthand if/else statements, but they do exist, and trust me they make things SO much more ordered in your code when used in the right way.
This is the Shorthand version &#8211; below this, if you cannot work it out for yourself is a nice description.

&#160; &#160; // [...]]]></description>
			<content:encoded><![CDATA[<p>You may or may not have heard of shorthand if/else statements, but they do exist, and trust me they make things SO much more ordered in your code when used in the right way.</p>
<p>This is the Shorthand version &#8211; below this, if you cannot work it out for yourself is a nice description.</p>
<div class="dean_ch" style="white-space: wrap;">
&nbsp; &nbsp; <span class="co1">// Will print out &#8216;i am male&#8217; if $myGender is &#8216;male&#8217; and vice-versa.</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="br0">&#40;</span><span class="re0">$myGender</span> == <span class="st0">&#8216;male&#8217;</span> ? <span class="st0">&#8216;i am male&#8217;</span> : <span class="st0">&#8216;I am female&#8217;</span><span class="br0">&#41;</span>;</div>
<p><strong>Description of how this actually works</strong><br />
We all (i would hope) know the normal way of writing if/else statements (here is a recap just incase)</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="re0">$myVar</span> = <span class="kw2">true</span>;<br />
<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$myVar</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;My Var is TRUE!&#8217;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;My Var is FALSE&#8217;</span>;<br />
<span class="br0">&#125;</span></div>
<p>That sort of statement is great for in the body of your code, but when want a dynamic selector within your HTML code, it gets very messy.</p>
<p>EG:</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$myGender</span> == <span class="st0">&#8216;male&#8217;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Gender is MALE.</span><br />
&nbsp; &nbsp; <span class="re0">$maleOpt</span> = <span class="st0">&#8217;selected&#8217;</span>;<br />
&nbsp; &nbsp; <span class="re0">$femaleOpt</span> = <span class="st0">&#8221;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// Gender is FEMALE.</span><br />
&nbsp; &nbsp; <span class="re0">$maleOpt</span> = <span class="st0">&#8221;</span>;<br />
&nbsp; &nbsp; <span class="re0">$femaleOpt</span> = <span class="st0">&#8217;selected&#8217;</span>;<br />
<span class="br0">&#125;</span></div>
<div class="dean_ch" style="white-space: wrap;">
&lt;select name=&quot;gender&quot;&gt;&lt;<br />
option value=&quot;female&quot; &lt;?= $femaleOpt; ?&gt;&gt;Female&lt;/option&gt;<br />
&lt;option value=&quot;male&quot; &lt;?= $maleOpt; ?&gt;&gt;Male&lt;/option&gt;<br />
&lt;/select&gt;<br />
&nbsp;</div>
<p>Now &#8211; that is alot to write and will make your HTML form look a total mess, this is where the shorthand comes in.  It allows us to write the same thing inline</p>
<p>Look:</p>
<div class="dean_ch" style="white-space: wrap;">
&lt;select name=&quot;gender&quot;&gt; <br />
&lt;option value=&quot;female&quot; &lt;?= ($myGender == &#8216;female&#8217; ? &#8217;selected&#8217; : &#8221;); ?&gt;&gt;Female&lt;/option&gt;<br />
&lt;option value=&quot;male&quot; &lt;?= ($myGender == &#8216;male&#8217; ? &#8217;selected&#8217; : &#8221;); ?&gt;&gt;Male&lt;/option&gt;<br />
&lt;/select&gt;<br />
&nbsp;</div>
<p>As you can see &#8211; there is a huge difference in the amount of code &#8211; and if Wordpress formatted it nicely &#8211; it would look loads better!</p>
<p><strong>And the all important Explanation!</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<span class="co1">// This will echo selected to the screen if $myGender is male.</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="br0">&#40;</span><span class="re0">$myGender</span> = <span class="st0">&#8216;male&#8217;</span> ? <span class="st0">&#8216; selected&#8217;</span> : <span class="st0">&#8221;</span><span class="br0">&#41;</span>;<br />
&nbsp;</div>
<p>So &#8211; $myGender is the variable we are checking, in this case we are checking to see if $myGender == &#8216;male&#8217;</p>
<p>The questionmark (?) seperates the &#8216;answers&#8217;.</p>
<p>The first &#8216;answer&#8217; is what is set/displayed when the query is true, the second is if the query is false.</p>
<p>This is the equilivent to :</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$myGender</span> == <span class="st0">&#8216;male&#8217;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8217;selected&#8217;</span>;<br />
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8221;</span>;<br />
<span class="br0">&#125;</span></div>
<p>Hope that helps some of you out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nodstrum.com/2008/02/14/shorthand-php-ifelse-statements-much-shorter-code/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
