<?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>CyberScorpion Bytes</title>
	<atom:link href="http://www.cyberscorpion.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberscorpion.com</link>
	<description></description>
	<lastBuildDate>Mon, 20 Feb 2012 23:06:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Making HTML Forms More Accessible and Improving Usability with the Label Tag</title>
		<link>http://www.cyberscorpion.com/2012-02/making-html-forms-more-accessible-and-improving-usability-with-the-label-tag/</link>
		<comments>http://www.cyberscorpion.com/2012-02/making-html-forms-more-accessible-and-improving-usability-with-the-label-tag/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 23:04:36 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML Forms]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=284</guid>
		<description><![CDATA[It&#39;s surprising that there are still HTML forms online not taking advantage of the &#60;label&#62; tag. In addition to being required for creating accessible forms, &#60;label&#62; tags improve the usability of forms. For example, instead of forcing visitors to click those tiny radio buttons, why not let them to click the text label. The Code [...]]]></description>
			<content:encoded><![CDATA[<p>It&#39;s surprising that there are still HTML forms online not taking advantage of the &lt;label&gt; tag. In addition to being required for creating accessible forms, &lt;label&gt; tags improve the usability of forms. For example, instead of forcing visitors to click those tiny radio buttons, why not let them to click the text label.<span id="more-284"></span></p>
<h3>The Code</h3>
<p>Let&#39;s say we have the following form fields:</p>
<p><code>&lt;div&gt;Name: &lt;input type="text" name="name"&gt;&lt;/div&gt;<br />
...<br />
&lt;div&gt;&lt;input type="radio" name="subscribe"&gt; Yes &amp;nbsp;<br />
&lt;input type="radio" name="subscribe"&gt; No&lt;/div&gt;</code></p>
<p>In order to add the &lt;label&gt; tags, we&#39;ll need to add ID attributes to the &lt;input&gt; tags. The attributes can be set to whatever we want, as long as every input tag has a different ID value.</p>
<p><code>&lt;div&gt;Name: &lt;input type="text" name="name" <b>id="name"</b>&gt;&lt;/div&gt;<br />
...<br />
&lt;div&gt;&lt;input type="radio" name="subscribe" <b>id="subscribe_yes"</b>&gt; Yes &amp;nbsp;<br />
&lt;input type="radio" name="subscribe" <b>id="subscribe_no"</b>&gt; No&lt;/div&gt;</code></p>
<p>The &lt;label&gt; tags then get added around the text label with the for attribute set to the corresponding &lt;input&gt; tag&#39;s ID attribute.</p>
<p><code>&lt;div&gt;<b>&lt;label for="name"&gt;</b>Name:<b>&lt;/label&gt;</b> &lt;input type="text" name="name" id="name"&gt;&lt;/div&gt;<br />
...<br />
&lt;div&gt;&lt;input type="radio" name="subscribe" id="subscribe_yes"&gt; <b>&lt;label for="subscribe_yes"&gt;</b>Yes<b>&lt;/label&gt;</b> &amp;nbsp;<br />
&lt;input type="radio" name="subscribe" id="subscribe_no"&gt; <b>&lt;label for="subscribe_no"&gt;</b>No<b>&lt;/label&gt;</b>&lt;/div&gt;</code></p>
<h3>Making Sure the Label Works</h3>
<p>When posting code to a website, its good practice to make sure everything works as expected. It&#39;s very easy to mistype the attribute values so they don&#39;t match or to forget some part of the code. Another common issue that may come up is when multiple form fields are given the same ID attribute.</p>
<p>An easy way to verify the &lt;label&gt; tags are functioning properly is to click the corresponding text labels. If the flashing text bar is placed in the corresponding form field, as shown in Figure 1, we&#39;re good. Likewise, radio buttons will be selected as we click their labels.</p>
<div class="pwn_figure"><img src="http://www.cyberscorpion.com/wp-content/uploads/2012/02/2012-02_FormLabelTag1.gif" alt="Screenshot showing the label tag in action" title="Screenshot showing the label tag in action" width="250" height="128" class="alignnone size-full wp-image-288" /><br />
<span>Figure 1.</span> Clicking the Text Labels</div>
<h3>Conclusion</h3>
<p>With the &lt;label&gt; tags in place, visitors can now click the corresponding field labels to place focus on the field of interest. Plus, the form will be more accessible to those using assistive technologies such as screen readers since the label will be read aloud when focus is placed on the fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-02/making-html-forms-more-accessible-and-improving-usability-with-the-label-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate Usernames with JavaScript: Working with Short Last Names</title>
		<link>http://www.cyberscorpion.com/2012-02/generate-usernames-with-javascript-working-with-short-last-names/</link>
		<comments>http://www.cyberscorpion.com/2012-02/generate-usernames-with-javascript-working-with-short-last-names/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 22:47:50 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML Forms]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=283</guid>
		<description><![CDATA[When generating usernames, one thing to consider is the length of the username. The code from last week&#39;s post may be problematic if you&#39;re looking for the username to be five characters or more and the user&#39;s last name is only two characters. After tacking on the first initial, you would only have three characters. [...]]]></description>
			<content:encoded><![CDATA[<p>When generating usernames, one thing to consider is the length of the username. The code from last week&#39;s post may be problematic if you&#39;re looking for the username to be five characters or more and the user&#39;s last name is only two characters. After tacking on the first initial, you would only have three characters. So let&#39;s look at getting closer to the desired results.<span id="more-283"></span></p>
<h3>Base Code</h3>
<p>Last week (<a href="http://www.cyberscorpion.com/2012-02/using-javascript-to-dynamically-generate-the-username-within-an-html-form/">Using JavaScript to Dynamically Generate the Username within an HTML Form</a>) we utilized the first and last name fields of an HTML form to generate a username with JavaScript.</p>
<p><code>&lt;form method="post" name="form" action=""&gt;<br />
&lt;div&gt;&lt;label for="fname"&gt;First Name: &lt;/label&gt;&lt;input type="text" name="fname" id="fname" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" onblur="<br />
if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\'+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/-+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.toLowerCase();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.form.username.value = username;<br />
}" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="username"&gt;Username: &lt;/label&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/div&gt;<br />
&lt;/form&gt;</code></p>
<h3>Updated Code</h3>
<p>The code works for the most part. However, there may be issues with users with short last names. If we&#39;re looking for a username that&#39;s at least five characters and a login is being created for Lama Su, we&#39;ll need to perform an extra test to see if the last name is at least four characters long. If it is, the username would be created as normal.</p>
<p><code>...<br />
if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>var username = '';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(document.form.lname.value.length &gt;= 4) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
...</code></p>
<p>For those with shorter last names, we use the entire last name, plus up to three letters of the first name.</p>
<p><code>...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(document.form.lname.value.length &gt;= 4) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = document.form.fname.value.substr(0,4) + document.form.lname.value.substr(0,49);</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
...</code></p>
<h3>Final Code</h3>
<p>Adding the following code to an HTML file should provide a working example of the JavaScript solution.</p>
<p><code>&lt;form method="post" name="form" action=""&gt;<br />
&lt;div&gt;&lt;label for="fname"&gt;First Name: &lt;/label&gt;&lt;input type="text" name="fname" id="fname" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" onblur="<br />
if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var username = '';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(document.form.lname.value.length >= 4) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = document.form.fname.value.substr(0,4) + document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\'+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/-+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.toLowerCase();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.form.username.value = username;<br />
}" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="username"&gt;Username: &lt;/label&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/div&gt;<br />
&lt;/form&gt;</code></p>
<h3>Conclusion</h3>
<p>The updated code may be crude, but it gets the job done. When creating a login for someone with a short last name, the username will include more of the first name. There are more improvements that could be made. We could, for example, dynamically include letters from the first name based on how many characters are needed to fulfill the five character minimum. Who knows, maybe that will be a topic for a future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-02/generate-usernames-with-javascript-working-with-short-last-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JavaScript to Dynamically Generate the Username within an HTML Form</title>
		<link>http://www.cyberscorpion.com/2012-02/using-javascript-to-dynamically-generate-the-username-within-an-html-form/</link>
		<comments>http://www.cyberscorpion.com/2012-02/using-javascript-to-dynamically-generate-the-username-within-an-html-form/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 22:52:25 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[HTML Forms]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=281</guid>
		<description><![CDATA[Usernames are typically made up of some combination of the user&#39;s first and last name. If that&#39;s the case, the form used to create those usernames could be modified to take advantage of the data in the first and last name fields. Instead of making someone manually type the username, JavaScript could be employed to [...]]]></description>
			<content:encoded><![CDATA[<p>Usernames are typically made up of some combination of the user&#39;s first and last name. If that&#39;s the case, the form used to create those usernames could be modified to take advantage of the data in the first and last name fields. Instead of making someone manually type the username, JavaScript could be employed to generate it automatically.<span id="more-281"></span></p>
<h3>Base Code</h3>
<p>When creating login accounts for a website&#39;s members only section, a common format for the username is to use the person&#39;s first initial and last name. So, let&#39;s say our form contains fields for the first name, last name, and username. Of course, the form would need more fields, a password field for example, but we&#39;ll keep things simple.</p>
<p><code>&lt;form method="post" name="form" action=""&gt;<br />
&lt;div&gt;&lt;label for="fname"&gt;First Name: &lt;/label&gt;&lt;input type="text" name="fname" id="fname" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="username"&gt;Username: &lt;/label&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/div&gt;<br />
&lt;/form&gt;</code></p>
<h3>Adding JavaScript</h3>
<p>As it stands, those filling out the form will need to manually complete all three fields. But, with a little JavaScript magic, we could dynamically create a username once the first and last name is known. Since forms are typically filled out from top to bottom, it&#39;s a safe bet that we&#39;ll have what&#39;s needed once the last name is filled out. So let&#39;s add an onblur event to the last name field.</p>
<p><code>...<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" <strong>onblur=""</strong> /&gt;&lt;/div&gt;<br />
...</code></p>
<p>Before doing anything, we need to check that the first and last name was entered. We should also make sure the username hasn&#39;t already been entered.</p>
<p><code>...<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" onblur="<br />
<strong>if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
}</strong>" /&gt;&lt;/div&gt;<br />
...</code></p>
<p>Now we&#39;ll grab the user&#39;s first initial and last name and merge them for the username.</p>
<p><code>...<br />
if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>var username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);</strong><br />
}" /&gt;&lt;/div&gt;<br />
...</code></p>
<p>The code so far will work with most names. However, there may be issues with names containing apostrophes, hyphens, or spaces. So let&#39;s add some code to remove unwanted characters.</p>
<p><code>...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var username = document.form.fname.value.substr(0,1) + document.form.lname.value.substr(0,49);<br />
<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\'+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/-+/g, '');</strong><br />
}" /&gt;&lt;/div&gt;<br />
...</code></p>
<p>Before inserting the username into the form, let&#39;s also make everything lower case.</p>
<p><code>...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\'+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/-+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>username = username.toLowerCase();</strong><br />
}"/&gt;&lt;/div&gt;<br />
...</code></p>
<p>Once the username is formatted as needed, we just need to store the results into the username field.</p>
<p><code>...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.toLowerCase();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>document.form.username.value = username;</strong><br />
}"/&gt;&lt;/div&gt;<br />
...</code></p>
<h3>Final Code</h3>
<p>Adding the following code to an HTML file should provide a working example of the JavaScript solution.</p>
<p><code>&lt;form method="post" name="form" action=""&gt;<br />
&lt;div&gt;&lt;label for="fname"&gt;First Name: &lt;/label&gt;&lt;input type="text" name="fname" id="fname" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="lname"&gt;Last Name: &lt;/label&gt;&lt;input type="text" name="lname" id="lname" onblur="<br />
if(document.form.username.value=='' &amp;&amp; document.form.fname.value!='' &amp;&amp; document.form.lname.value!='') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var username = document.form.fname.value.substr(0,1) + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.form.lname.value.substr(0,49);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\s+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/\'+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.replace(/-+/g, '');<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;username = username.toLowerCase();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.form.username.value = username;<br />
}" /&gt;&lt;/div&gt;<br />
&lt;div&gt;&lt;label for="username"&gt;Username: &lt;/label&gt;&lt;input type="text" name="username" id="username" /&gt;&lt;/div&gt;<br />
&lt;/form&gt;</code></p>
<h3>Conclusion</h3>
<p>With the JavaScript code in place, those filling out the form will have an easier time. Plus the username entered is more likely to match the formatting guidelines you have in place. Of course, it&#39;s still necessary to double check the username with a server-side language such as PHP. You&#39;ll also need to make sure the username doesn&#39;t already exist.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-02/using-javascript-to-dynamically-generate-the-username-within-an-html-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Internet Explorer 9 to Test Websites with IE8 and IE7</title>
		<link>http://www.cyberscorpion.com/2012-01/using-internet-explorer-9-to-test-websites-with-ie8-and-ie7/</link>
		<comments>http://www.cyberscorpion.com/2012-01/using-internet-explorer-9-to-test-websites-with-ie8-and-ie7/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 17:56:48 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser testing]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=276</guid>
		<description><![CDATA[Did you know that Internet Explorer 9 (IE9) provides the capability for viewing websites in IE8 and IE7? There&#39;s no need to install an add-on or download anything from a browser archive. The power to test websites using all three versions of Internet Explorer is built in. Of course, the feature for switching between the [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that Internet Explorer 9 (IE9) provides the capability for viewing websites in IE8 and IE7? There&#39;s no need to install an add-on or download anything from a browser archive. The power to test websites using all three versions of Internet Explorer is built in. Of course, the feature for switching between the different options is a little buried.<span id="more-276"></span></p>
<h3>Background</h3>
<p>Back when IE8 was released, Microsoft added the Compatibility View which emulates IE7. The option was introduced to help display websites which would normally break in the new version of the browser. This special view was enabled by clicking the Compatibility View button near the address field <em>(see Figure 1)</em>.</p>
<div class="pwn_figure"><img title="Screenshot showing the Compatibility View button in Internet Explorer 8" src="http://www.cyberscorpion.com/wp-content/uploads/2012/01/2012-01_InternetExplorerMultiBrowser1.gif" alt="Screenshot showing the Compatibility View button in Internet Explorer 8" width="178" height="77" /><br />
<span>Figure 1.</span> Compatibility View Button</div>
<p>Now, with IE9, the question is what happens when Compatibility View activated? Does it still show IE7 or IE8? While digging for the answer, something better popped up—the Developer Tools panel.</p>
<h3>Switching Browser Versions</h3>
<p>The Developer Tools panel is what gives us the option for switching between the different versions of the browser. To access the panel,</p>
<ol>
<li>Click the Tools button <em>(see Figure 2)</em></li>
<li>Click F12 developers tools
<ul>
<li>As the option&#39;s name suggests, the F12 key also opens the Developer Tools panel</li>
</ul>
</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-279" title="Screenshot showing Internet Explorer's tools button" src="http://www.cyberscorpion.com/wp-content/uploads/2012/01/2012-01_InternetExplorerMultiBrowser2.gif" alt="Screenshot showing Internet Explorer's tools button" width="287" height="280" /><br />
<span>Figure 2.</span> Tools Button</div>
<p>With the panel open, we can switch browser versions by changing the Browser Mode <em>(see Figure 3)</em>.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-280" title="Screenshot showing Internet Explorer's Browser Mode Option" src="http://www.cyberscorpion.com/wp-content/uploads/2012/01/2012-01_InternetExplorerMultiBrowser3.gif" alt="Screenshot showing Internet Explorer's Browser Mode Option" width="404" height="164" /><br />
<span>Figure 3.</span> Browser Mode Option</div>
<h3>Conclusion</h3>
<p>Using a single browser, we can now see how our website(s) function in Internet Explorer 7, 8, and 9 and adjust our CSS and HTML code accordingly. If only Microsoft would have included IE6 into the mix. But then again, it might be better to forget that version ever existed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-01/using-internet-explorer-9-to-test-websites-with-ie8-and-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Date Format Chosen by the User Instead of Hard-Coding Your Own in the WordPress Theme</title>
		<link>http://www.cyberscorpion.com/2012-01/using-the-date-format-chosen-by-the-user-instead-of-hard-coding-your-own-in-the-wordpress-theme/</link>
		<comments>http://www.cyberscorpion.com/2012-01/using-the-date-format-chosen-by-the-user-instead-of-hard-coding-your-own-in-the-wordpress-theme/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 22:41:07 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[dates]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=275</guid>
		<description><![CDATA[WordPress has a setting under the admin panel where blog owners can indicate how dates should be displayed for blog posts and comments made to the blog. The setting isn&#39;t very useful though when the date format is hard coded into the theme. Instead of making users edit the theme files, let&#39;s take advantage of [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress has a setting under the admin panel where blog owners can indicate how dates should be displayed for blog posts and comments made to the blog. The setting isn&#39;t very useful though when the date format is hard coded into the theme. Instead of making users edit the theme files, let&#39;s take advantage of the WordPress setting.<span id="more-275"></span></p>
<h3>Hard-coded Date Format</h3>
<p>WordPress theme developers seem to utilize code like the following when displaying content that has dates, such as posts and comments:</p>
<p><code>&lt;?php the_time("M d, Y"); ?&gt;</code></p>
<p>However, as discussed last week (<a href="http://www.cyberscorpion.com/2012-01/choosing-the-date-format-in-wordpress-themes-lets-give-control-back-to-the-user/">Choosing the Date Format in WordPress Themes: Let&#39;s Give Control Back to the User</a>), the format inside the_time() function prevents users from changing the date format, unless they modify the theme files. Well, we can&#39;t use the_time() function without some kind of format. Leaving it blank only gives the time a post was published. So what about <a href="http://codex.wordpress.org/Function_Reference/the_date">the_date()</a> function?</p>
<p>At first glance, the_date() seems to work fine. But, upon closer inspection the function has some &quot;odd&quot; behavior when a page has multiple posts from the same date—only the first post gets the date. The rest have a blank space where the date should be.</p>
<h3>Alternate Solution</h3>
<p>For the comments section of our blog, the <a href="http://codex.wordpress.org/Function_Reference/comment_date">comment_date()</a> function works perfectly. The date is always displayed; even if there are multiple comments on the same day. To use the date format set under the WordPress admin panel, we just need to leave the parameters blank.</p>
<p><code>&lt;?php comment_date(); ?&gt;</code></p>
<p>Maintaining the user&#39;s format for posts is a little trickier. To avoid the issue with multiple posts on the same day, we&#39;ll use the_time() function. The <a href="http://codex.wordpress.org/Function_Reference/get_option">get_options()</a> function can then be used to get the date format from the admin panel.</p>
<p><code>&lt;?php the_time(get_option('date_format')); ?&gt;</code></p>
<h3>Conclusion</h3>
<p>Now, there may be areas where it makes sense to hard code the date format. When someone&#39;s viewing the blog archive by month for example, the page header text only needs to show the month and year. But the majority of the dates can utilize the_time() function in conjunction with get_option()&#8230;or the comment_date() function for comments posted to the blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-01/using-the-date-format-chosen-by-the-user-instead-of-hard-coding-your-own-in-the-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choosing the Date Format in WordPress Themes: Let&#8217;s Give Control Back to the User</title>
		<link>http://www.cyberscorpion.com/2012-01/choosing-the-date-format-in-wordpress-themes-lets-give-control-back-to-the-user/</link>
		<comments>http://www.cyberscorpion.com/2012-01/choosing-the-date-format-in-wordpress-themes-lets-give-control-back-to-the-user/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 22:29:55 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dates]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=270</guid>
		<description><![CDATA[So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn&#39;t match their organization&#39;s style guidelines or maybe the format isn&#39;t grammatically correct. Changing a hard-coded date requires users to dig through file [...]]]></description>
			<content:encoded><![CDATA[<p>So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn&#39;t match their organization&#39;s style guidelines or maybe the format isn&#39;t grammatically correct. Changing a hard-coded date requires users to dig through file after file to modify every instance. Plus, if the theme developer releases an update, the user may need to do it all over again. To save users the hassle, why not let them decide how the dates are displayed. There is a setting in WordPress after all.<span id="more-270"></span></p>
<p><img class="alignright size-full wp-image-273" title="Screenshot of WordPress' date format setting" src="http://www.cyberscorpion.com/wp-content/uploads/2012/01/2012-01_DateFormatPartI.gif" alt="Screenshot of WordPress' date format setting" width="326" height="167" />Now, there may be reasons for theme developers to specify the date format, but they&#39;re probably not in the best interest of the user. Here are some reasons not to hard code the date:</p>
<ul class="pwn_double">
<li><strong>Give Users the Control</strong> — themes users have different wants and needs. The more control they have over the theme used on their website to meet those needs, the better. As mentioned previously (<a href="http://www.cyberscorpion.com/2011-09/you-havent-even-started-blogging-and-you-already-have-a-typo/">You Haven’t Even Started Blogging and You Already Have a Typo</a>), there are quite a few themes that incorrectly list dates using the ordinal format (ex: January 16th, 2012). It would be nice if the user could modify the format without editing the theme files.</li>
<li><strong>Increase Ease of Maintenance</strong> — WordPress makes it relatively easy to edit theme files. However, it&#39;s much easier to change the date format under the admin panel versus replacing all the hard-coded references. Plus, if a user modifies the theme files, they may need to do it all over again whenever new versions of the theme are released.</li>
<li><strong>Prevent Inconsistencies</strong> — since a theme is made up of several PHP files, there&#39;s a greater chance for the date to be coded differently from page to page. One may list the month as three letters while another may spell out the month. Utilizing WordPress&#39; built-in feature to maintain dates is an easy way to remain consistent.</li>
<li><strong>Match Their Brand</strong> — some organizations have spent a fair amount of time developing a style guide for their content. These guidelines may describe how to format things like dates so that there is consistency throughout the website, marketing materials, etc.</li>
</ul>
<h3>Conclusion</h3>
<p>Hopefully this was enough to convince the theme developers out there that relinquishing the control over the date is in the best interest of the user. Let&#39;s utilize WordPress&#39; built-in feature and stop making users edit theme files just to change the date format.</p>
<p>If you&#39;re not swayed, I would love to hear why hard-coding the date format into the theme is the preferred option. Or maybe there are some additional arguments for letting the user decide the format. Either way, please enter your comments below.</p>
<p>Note: for those wanting to utilize the date format set through the WordPress admin panel, you&#39;ll want to come back next week. We&#39;ll discuss some of the options available for getting the date and things to watch out for.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-01/choosing-the-date-format-in-wordpress-themes-lets-give-control-back-to-the-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do Single-Quoted Strings Cause More Harm Than Good in PHP?</title>
		<link>http://www.cyberscorpion.com/2012-01/do-single-quoted-strings-cause-more-harm-than-good-in-php/</link>
		<comments>http://www.cyberscorpion.com/2012-01/do-single-quoted-strings-cause-more-harm-than-good-in-php/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 23:39:56 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[coding practices]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=267</guid>
		<description><![CDATA[When writing PHP code, is it better to use single or double quotes? Using single quotes wherever possible will improve the performance of your code, but does it cost too much in productivity when less experienced developers work with the code? After all, certain things won&#39;t work as some might expect when using single quotes, [...]]]></description>
			<content:encoded><![CDATA[<p>When writing PHP code, is it better to use single or double quotes? Using single quotes wherever possible will improve the performance of your code, but does it cost too much in productivity when less experienced developers work with the code? After all, certain things won&#39;t work as some might expect when using single quotes, such as variables inside the string.<span id="more-267"></span></p>
<p><img class="alignright size-full wp-image-269" title="Graphic which says 'Single' vs &quot;Double&quot;" src="http://www.cyberscorpion.com/wp-content/uploads/2012/01/2012-01_SingleVsDoubleQuotes.jpg" alt="Graphic which says 'Single' vs &quot;Double&quot;" width="250" height="181" />Before getting to the question at hand, let&#39;s look at the difference between single and double quotes.</p>
<h3>Background</h3>
<p>In PHP, quotes are used to indicate that something is a string. For example, the content between the double quotes below is considered a string.</p>
<p><code>print "PHP is very useful for displaying content to the screen. If you make websites, PHP may be a great solution for you.";</code></p>
<p>Well, you may have noticed that there were a few keywords throughout the string. Without the quotes, PHP would have a difficult time knowing what do with the &quot;if&quot; for example. Should it be a string of an if() construct? So we use quotes around the string to prevent PHP from throwing an error.</p>
<p>Also, the string could have been surrounded with single quotes and it works as expected. However, if we plan to add something to the string that needs to be interpreted by PHP, such as a variable, we need to use double quotes.</p>
<p><code>$customer_name = 'Sam';<br />
print "Hello $customer_name";</code></p>
<p>Using single quotes in the above print statement would display &quot;Hello $customer_name&quot; instead of &quot;Hello Sam&quot;.</p>
<h3>Why Single Quotes Are More Efficient</h3>
<p>If double quotes allow us to do more with strings, why would we ever using single quotes? Well, the thing about double quotes is that PHP needs to look at everything inside the string before displaying it; whether or not the string contains variables. Single quotes on the other hand, are displayed as is. PHP doesn&#39;t really look at what&#39;s inside requiring less processor time.</p>
<p>Of course, we most likely won&#39;t notice the difference between using single vs. double quotes since the effect is minimal, unless we were working with millions of strings.</p>
<h3>Problem with Single Quotes</h3>
<p>So with the differences between single and double quotes in mind, let&#39;s talk about the issue alluded to earlier with using single quotes. If our program has dozens or hundreds of lines which go back and forth between single- and double-quoted strings, what happens when someone adds a variable or some other character which doesn&#39;t work from within single quotes like the new line character (&quot;\n&quot;)? Well naturally, that content won&#39;t display as expected.</p>
<p>The fix for the problem may not be apparent if they&#39;ve been adding the content in question elsewhere and it works just fine. We&#39;ve all probably had one of those days where things don&#39;t quite click. We may search hours because we&#39;re looking at the wrong thing. Maybe we&#39;re trying to figure why a variable doesn&#39;t contain data so we trace it throughout the program. But in the end, we discover that variable name was misspelled.</p>
<h3>Conclusion</h3>
<p>So is it better to avoid a potential pitfall&#8230;or do we opt for keeping the code streamlined? In the end, that&#39;s a question that needs to be answered by you and/or your team. For what it&#39;s worth, I typically prefer keeping code as clean as possible. So using single quotes when possible is my option of choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-01/do-single-quoted-strings-cause-more-harm-than-good-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP&#8217;s implode() Function to Display an Array as a Value-Separated String</title>
		<link>http://www.cyberscorpion.com/2012-01/using-phps-implode-function-to-display-an-array-as-a-value-separated-string/</link>
		<comments>http://www.cyberscorpion.com/2012-01/using-phps-implode-function-to-display-an-array-as-a-value-separated-string/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 20:13:57 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=265</guid>
		<description><![CDATA[When displaying the contents of an array in PHP, what is your go to method? For example, if the items need to be displayed as a comma-separated or HTML unordered list, would you use a foreach() or for() loop? Utilizing a loop would accomplish the task. But there are other options. Why not give the [...]]]></description>
			<content:encoded><![CDATA[<p>When displaying the contents of an array in PHP, what is your go to method? For example, if the items need to be displayed as a comma-separated or HTML unordered list, would you use a foreach() or for() loop? Utilizing a loop would accomplish the task. But there are other options. Why not give the implode() function a shot.<span id="more-265"></span></p>
<p>Let&#39;s say we have an array of our customer&#39;s favorite movies.</p>
<p><code>&lt;?php<br />
$movies_to_display = array('Star Wars', 'Book of Eli', 'Avatar', 'Star Trek', 'Matrix');<br />
?&gt;</code></p>
<p>To display the movies as a comma-separated list, we might utilize a foreach() loop.</p>
<p><code>&lt;?php<br />
print '&lt;div&gt;';<br />
foreach($movies_to_display as $curr_movie) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "$curr_movie, ";<br />
}<br />
print '&lt;/div&gt;';<br />
?&gt;</code></p>
<p>But that displays an extra comma at the end of the list. One way to avoid the unwanted character is to use a for() loop instead.</p>
<p><code>&lt;?php<br />
print '&lt;div&gt;';<br />
for($i=0; $i &lt; count($movies_to_display); $i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print ($i==0) ? $movies_to_display[$i] : ", $movies_to_display[$i]";<br />
}<br />
print '&lt;/div&gt;';<br />
?&gt;</code></p>
<p>The first time through the loop (when $i equals zero), only the current value is displayed. Otherwise it displays a comma, space, and then the value. Now the list is displayed without the extra comma.</p>
<p>Note that the above code uses the Ternary Operator (?:) instead of the standard if/else structure. For more information about how the operator works, check out my previous post titled &quot;<a href="http://www.cyberscorpion.com/2011-09/utilizing-the-short-hand-if-within-a-php-string/">Utilizing the Short-hand if() within a PHP String</a>.&quot;</p>
<h3>Using implode() Instead</h3>
<p>As with most things in PHP, there are many other solutions which involve looping constructs like foreach(), while(), etc. However, there is a more efficient way. Unless the loop is doing more than displaying the list, we could use <a href="http://php.net/manual/en/function.implode.php">implode()</a> instead.</p>
<p><code>&lt;?php<br />
print '&lt;div&gt;' . implode(', ', $movies_to_display) . '&lt;/div&gt;';<br />
?&gt;</code></p>
<p>The first argument of the implode() function determines what&#39;s added between each array value. So what if we need to display the values as an HTML list? Well that&#39;s pretty easy to do with a little extra code before and after the implode().</p>
<p><code>&lt;?php<br />
print '&lt;ul&gt;&lt;li&gt;' . implode('&lt;/li&gt;&lt;li&gt;', $movies_to_display) . '&lt;/li&gt;&lt;/ul&gt;';<br />
?&gt;</code></p>
<h3>Conclusion</h3>
<p>Although loops can be modified to display the data as we want, there are alternatives which may be better to suited for our needs. Displaying an array of items separated by some character(s) is one of those times. So save yourself a few lines of code and implode() the array instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2012-01/using-phps-implode-function-to-display-an-array-as-a-value-separated-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Managing Website Contact Information with E-mail Aliases</title>
		<link>http://www.cyberscorpion.com/2011-12/managing-website-contact-information-with-e-mail-aliases/</link>
		<comments>http://www.cyberscorpion.com/2011-12/managing-website-contact-information-with-e-mail-aliases/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 06:10:09 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[e-mail]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=263</guid>
		<description><![CDATA[E-mail addresses change. Employees retire, switch jobs, etc. With that in mind, why would you list addresses that are tied to specific people on an organization&#39;s website? If your Contact Us page says &#34;For questions or assistance, contact Bob@yahoo.com, Mary@gmail.com, or Scott@mywebsite.com&#34;. What happens if Bob quits? It may only take a few seconds to [...]]]></description>
			<content:encoded><![CDATA[<p>E-mail addresses change. Employees retire, switch jobs, etc. With that in mind, why would you list addresses that are tied to specific people on an organization&#39;s website? If your Contact Us page says &quot;For questions or assistance, contact Bob@yahoo.com, Mary@gmail.com, or Scott@mywebsite.com&quot;. What happens if Bob quits? It may only take a few seconds to update the page, but things could be easier with e-mail aliases.<span id="more-263"></span></p>
<p>Okay, there are places where it makes sense to post an employee&#39;s e-mail address, such as a biography page. However, when a customer isn&#39;t necessarily looking to contact a specific staff member, utilizing a generic e-mail address might be the answer. For example, organizations could create an e-mail address where customers can ask questions about the website. Another could be utilized for the Contact Us page mentioned earlier. Instead of listing Bob, Mary, and Scott&#39;s contact information separately, an address like ContactUs@mywebsite.com could be posted. Then if Bob leaves, it has no effect on the website.</p>
<h3>Additional Benefits</h3>
<p>In addition to limiting the amount of change, aliases can distribute incoming messages to the entire project team. So the ContactUs e-mail can still be sent to Bob, Mary, and Scott. There&#39;s no need for anyone to forward messages since that&#39;s done automatically.</p>
<p>Since the incoming messages are sent to one or more personal e-mail accounts, there is no need for the recipients to check a separate e-mail account. The messages appear with all his/her other messages.</p>
<h3>Creating an Alias</h3>
<p>Setting up an e-mail alias will depend on the service provider. Check with the host for the organization&#39;s website or where the organization&#39;s domain names are registered through. If they allow for the creation of e-mail aliases, the organization&#39;s website address can be used for the alias, helping to maintain the organization&#39;s brand.</p>
<p>For those service providers that allow aliases, they likely have a form asking what to use for the alias; ContactUs@mywebsite.com for example. Then there should be a field for entering who the incoming messages should be forwarded to.</p>
<h3>Conclusion</h3>
<p>Once the ContactUs@mywebsite.com address has been posted to the website, we shouldn&#39;t need to worry about staff members leaving the organization. Who the alias sends messages to will need to be updated, but the website doesn&#39;t need to be modified. And for those who saved the e-mail to their address book won&#39;t be emailing an address that may not exist anymore&#8230;or a potentially disgruntle employee.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-12/managing-website-contact-information-with-e-mail-aliases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy Way for Comment Spam to Bypass the WordPress Moderation Queue</title>
		<link>http://www.cyberscorpion.com/2011-12/easy-way-for-comment-spam-to-bypass-the-wordpress-moderation-queue/</link>
		<comments>http://www.cyberscorpion.com/2011-12/easy-way-for-comment-spam-to-bypass-the-wordpress-moderation-queue/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 23:59:07 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=258</guid>
		<description><![CDATA[Did you know that spammers could bypass the WordPress comment moderation feature? If your blog is set to automatically post comments from visitors who have previously approved comments, you could be at risk. However, there is a quick fix to the issue. For those of us who run a blog or manage a website, there&#39;s [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that spammers could bypass the WordPress comment moderation feature? If your blog is set to automatically post comments from visitors who have previously approved comments, you could be at risk. However, there is a quick fix to the issue.<span id="more-258"></span></p>
<p><img class="alignright size-full wp-image-260" title="WordPress screenshot showing comment moderation options" src="http://www.cyberscorpion.com/wp-content/uploads/2011/12/2011-12_WordPressSpam1.gif" alt="WordPress screenshot showing comment moderation options" width="340" height="123" />For those of us who run a blog or manage a website, there&#39;s a good chance that we&#39;ve seen form spam before&#8230;and probably boat loads of it. There are options for limiting the amount of spam, such as installing a CAPTCHA or some other user test. But nothing is 100% effective. In the end, if we can prevent our customers from seeing that spam, we&#39;re in good shape.</p>
<p>The benefit of blogging software, like WordPress, is we are given the capability to moderate comments sent through the website. If everything checks out, we just need to click a button to approve it. A problem with moderating comments, however, is the delay. Even if we&#39;re constantly monitoring the blog, there is still going to be some kind of delay before the comments go live for everyone to see.</p>
<p>To mitigate the delay, WordPress gives us an option to automatically go live with comments from anyone who has had comments approved in the past. For example, if Sally Somebody leaves a comment and it&#39;s approved, all future comments from Sally will be automatically posted to the website.</p>
<p>Having WordPress automatically approve comments is an excellent feature, especially when there is a lot of back and forth between visitors to the blog. The downside is that all a spammer needs to do is figure out the e-mail address and name of someone who posted comments. There is no IP address check or anything extra being done to make sure they are the same person.</p>
<p>There are probably other ways to deal with this issue, but if we&#39;re looking for quick solution, we can require that all comments be moderated by the following steps:</p>
<ul>
<li>Log into the admin area for the blog</li>
<li>Click <strong>Settings</strong></li>
<li>Click <strong>Discussion</strong> <em>(see Figure 1)</em></li>
<li>Check the box which says &quot;An administrator must always approve the comment&quot; <em>(see Figure 2)</em></li>
<li>Click <strong>Save Changes</strong></li>
</ul>
<div class="pwn_figure"><img class="alignnone size-full wp-image-261" title="WordPress screenshot showing the Discussion menu option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/12/2011-12_WordPressSpam2.gif" alt="WordPress screenshot showing the Discussion menu option" width="270" height="166" /><br />
<span>Figure 1.</span> Discussion Menu Option</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-262" title="WordPress screenshot showing the checkbox option to prevent comments from being auto-approved" src="http://www.cyberscorpion.com/wp-content/uploads/2011/12/2011-12_WordPressSpam3.gif" alt="WordPress screenshot showing the checkbox option to prevent comments from being auto-approved" width="520" height="99" /><br />
<span>Figure 2.</span> Checkbox Option to Prevent Auto-Approve</div>
<h3>Conclusion</h3>
<p>Disabling the auto-approve feature in WordPress may not beneficial for everyone. For example, if you receive hundreds or thousands of comments per day, manually approving those comments may be too much hassle. But if spammers are overwhelming the comments feed by pretending to be one of your regular visitors, you have another option for stopping them.</p>
<p>If you know of other ways to prevent this issue, I would love to hear your feedback in the comments section below. For example, maybe there&#39;s a plugin that forces WordPress to validate the visitor&#39;s IP address against their previous comments&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-12/easy-way-for-comment-spam-to-bypass-the-wordpress-moderation-queue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slicing Strings with PHP: Be Mindful of Output that Contains HTML Tags</title>
		<link>http://www.cyberscorpion.com/2011-12/slicing-strings-with-php-be-mindful-of-output-that-contains-html-tags/</link>
		<comments>http://www.cyberscorpion.com/2011-12/slicing-strings-with-php-be-mindful-of-output-that-contains-html-tags/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 23:25:05 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=257</guid>
		<description><![CDATA[When experimenting with strings which contain HTML code, be mindful of what you&#39;re getting for output. Especially if there is something unexpected about the results. That&#39;s what I learned the hard way when extracting an open anchor tag from the source code of a web page. The variables used to locate the anchor tag appeared [...]]]></description>
			<content:encoded><![CDATA[<p>When experimenting with strings which contain HTML code, be mindful of what you&#39;re getting for output. Especially if there is something unexpected about the results. That&#39;s what I learned the hard way when extracting an open anchor tag from the source code of a web page. The variables used to locate the anchor tag appeared to be working, but for some reason the extracted code wouldn&#39;t display to the screen. Let&#39;s take a look at where I went wrong.<span id="more-257"></span></p>
<h3>The Problem</h3>
<p>Let&#39;s say we&#39;re tasked with getting the open anchor tag for the &quot;About Us&quot; link from the code below. Note that there is more code, but we&#39;ll keep things simple.</p>
<p><code>&lt;?php<br />
$code_from_website = '...ul id="Menu1"&gt;&lt;li&gt;&lt;a href="/about/"  onmouseover="ShowMenu(\'Menu1\')" onfocus="ShowMenu(\'Menu1\')" onmouseout="HideMenu()" onblur="HideMenu()"&gt;About Us&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="/about/history.php"  onmouseover="ShowMenu(\'Menu1\')" onfocus="ShowMenu(\'Menu1\')" onmouseout="HideMenu()" onblur="HideMenu()"&gt;History&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=...';<br />
?&gt;</code></p>
<p>To extract the anchor tag, we&#39;ll need to figure out where the link text (About Us) starts and where the corresponding open anchor tag is. The print statements are there for us to see that we&#39;re getting seemingly valid values.</p>
<p><code>&lt;?php<br />
$position_linkText = strpos($code_from_website, 'About Us');<br />
$position_anchorStart = strrpos( substr($code_from_website, 0, $position_linkText), '&lt;a');<br />
&nbsp;<br />
print "&lt;div&gt;Link Text Position: $position_linkText&lt;/div&gt;";<br />
print "&lt;div&gt;Open Anchor Position: $position_anchorStart&lt;/div&gt;";<br />
?&gt;</code></p>
<p>With the new variables, we know where the open anchor tag is in the overall string. So let&#39;s grab the code and display the result.</p>
<p><code>&lt;?php<br />
$length_openAnchor = $position_linkText-$position_anchorStart;<br />
$openAnchorCode    = substr($code_from_website, $position_anchorStart, $length_openAnchor);<br />
&nbsp;<br />
print "&lt;div&gt;Open Anchor Tag Length: $length_openAnchor&lt;/div&gt;";<br />
print "&lt;div&gt;Anchor Code: $openAnchorCode&lt;/div&gt;";<br />
?&gt;</code></p>
<p>The first print statement works as expected, but the second one doesn&#39;t seem to display anything. So what went wrong? Everything else displays fine&#8230;</p>
<p>Well, if we think about; the answer is obvious. The $openAnchorCode variable contains HTML code for to open an anchor tag. What happens if display an anchor tag without a text label? We get a hidden anchor which is only visible by looking at the source code. With that in mind, we just need to make one small change to our code.</p>
<p><code>&lt;?php<br />
print "&lt;div&gt;Anchor Code: " . htmlentities($openAnchorCode) . "&lt;/div&gt;";<br />
?&gt;</code></p>
<h3>Conclusion</h3>
<p>The moral of the story is that we need to be mindful of what we&#39;re trying to display. If the output contains HTML tags, or anything that can be interpreted by the browser, mysterious things may happen. We&#39;ll end up wasting time trying to figure out where the program went wrong&#8230;and most likely looking in the wrong place for the fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-12/slicing-strings-with-php-be-mindful-of-output-that-contains-html-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reducing the Number of Clicks When Saving Files Deep within a Website&#8217;s Structure by Using Shortcuts</title>
		<link>http://www.cyberscorpion.com/2011-12/reducing-the-number-of-clicks-when-saving-files-deep-within-a-websites-structure-by-using-shortcuts/</link>
		<comments>http://www.cyberscorpion.com/2011-12/reducing-the-number-of-clicks-when-saving-files-deep-within-a-websites-structure-by-using-shortcuts/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 23:00:45 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=253</guid>
		<description><![CDATA[When receiving lots of files via e-mail to convert to PDF and post on the website, it can be a time consuming project. Especially when the files are saved to a folder deep within a website and the software used to create the PDF doesn&#39;t remember the last folder saved to. Instead of clicking folder [...]]]></description>
			<content:encoded><![CDATA[<p>When receiving lots of files via e-mail to convert to PDF and post on the website, it can be a time consuming project. Especially when the files are saved to a folder deep within a website and the software used to create the PDF doesn&#39;t remember the last folder saved to. Instead of clicking folder after folder for each file, let&#39;s look at folder shortcuts.<span id="more-253"></span></p>
<h3>Background</h3>
<p>Let&#39;s say a client sent a few e-mails containing 20 or so files. The files need to be saved as PDFs in the stakeholder meetings page under the corresponding downloads folder <em>(see Figure 1)</em>. For example, if the file is for the November 2011 meeting, the PDF should be saved to the &quot;2011-11&quot; folder.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-255" title="Screenshot showing the example website structure" src="http://www.cyberscorpion.com/wp-content/uploads/2011/12/2011-12_DesktopShortcut1.gif" alt="Screenshot showing the example website structure" width="193" height="187" /><br />
<span>Figure 1.</span> Example Website Structure</div>
<p>With the destination folder being several directories deep, it takes quite a few clicks to save each of PDF where we want it&#8230;and Figure 1 doesn&#39;t even show the other folders that we may need to click through to get to the base website folder. To speed things up, let&#39;s create a shortcut which goes directly to the destination folder.</p>
<h3>Utilizing a Shortcut</h3>
<p>On a Windows computer, we just need to drag the &quot;downloads&quot; folder, while holding the Alt key, to a place that&#39;s easily accessible—such as the desktop. We should now have a folder shortcut like the one shown in Figure 2.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-256" title="Screenshot the folder shortcut" src="http://www.cyberscorpion.com/wp-content/uploads/2011/12/2011-12_DesktopShortcut2.gif" alt="Screenshot the folder shortcut" width="207" height="129" /><br />
<span>Figure 2.</span> Shortcut to the Downloads Folder</div>
<p>Now, instead of clicking folder after folder, we can go to the desktop and click the shortcut which magically transports us to the destination folder.</p>
<h3>Conclusion</h3>
<p>There may be more efficient ways to get the PDFs where they need to be without a shortcut. We could, for example, move all the files to where they need to be on the website and convert them there. Some software defaults to the current folder when asking where to save the PDF. After the PDF is created, we could delete the originating file. We could also save the PDFs to an easily accessible folder (like the desktop). Then just drag the files over to the downloads folder when done.</p>
<p>In the end, we can use whatever method works best for the given scenario.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-12/reducing-the-number-of-clicks-when-saving-files-deep-within-a-websites-structure-by-using-shortcuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excluding Website Traffic Based on an IP Address in Google Analytics</title>
		<link>http://www.cyberscorpion.com/2011-11/excluding-website-traffic-based-on-an-ip-address-in-google-analytics/</link>
		<comments>http://www.cyberscorpion.com/2011-11/excluding-website-traffic-based-on-an-ip-address-in-google-analytics/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 23:06:04 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=245</guid>
		<description><![CDATA[Tracking the usage of your website can be very insightful. It helps identify which pages are the most popular, shows where your visitors are from, what browsers they use, etc. However, if you&#39;re visiting the website all the time to verify things are working, updating pages, etc. it can throw off the stats. So unless [...]]]></description>
			<content:encoded><![CDATA[<p>Tracking the usage of your website can be very insightful. It helps identify which pages are the most popular, shows where your visitors are from, what browsers they use, etc. However, if you&#39;re visiting the website all the time to verify things are working, updating pages, etc. it can throw off the stats. So unless you&#39;re trying to pad the numbers, let&#39;s look at filtering out results by IP address in Google Analytics.<span id="more-245"></span></p>
<p>In case it isn&#39;t obvious, you&#39;ll need a Google Analytics account and the tracking code must be embedded within your website for the filter option to work. Also, the method for accessing the filters depends on which version of the analytics admin panel you&#39;re using. As far as I know, there are two versions of the panel which will be discussed in a moment. There may be other variations, but I can only talk about what available to me since I&#39;m not on the Google payroll. Let&#39;s start with the new beta version.</p>
<h3>Google Analytics Beta</h3>
<p>To prevent our visits from being tracked, we need to:</p>
<ol>
<li>Log into <a href="https://www.google.com/analytics/">Google Analytics</a></li>
<li>Click the options icon near the top <em>(see Figure 1)</em></li>
<li>Click the link for the analytics account the filter applies to</li>
<li>Click <strong>Filters</strong> <em>(see Figure 2)</em></li>
<li>Click <strong>New Filter</strong> <em>(see Figure 3)</em></li>
<li>Name the filter</li>
<li>Select <strong>traffic from the IP addresses</strong> <em>(see Figure 4)</em></li>
<li>Enter the IP address to exclude</li>
<li>Choose the website profile(s) the filter applies to and click <strong>Add</strong></li>
<li>Click <strong>Save</strong></li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-247" title="Screenshot showing the options icon in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter1.gif" alt="Screenshot showing the options icon in Google Analytics" width="198" height="134" /><br />
<span>Figure 1.</span> Options Icon</div>
<p>&nbsp;</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-248" title="Screenshot showing the Filters tab in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter2.gif" alt="Screenshot showing the Filters tab in Google Analytics" width="293" height="108" /><br />
<span>Figure 2.</span> Filters Tab</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-249" title="Screenshot showing the New Filter button in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter3.gif" alt="Screenshot showing the New Filter button in Google Analytics" width="247" height="110" /><br />
<span>Figure 3.</span> New Filter Button</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-250" title="Screenshot showing the Traffic from the IP Addresses option in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter4.gif" alt="Screenshot showing the Traffic from the IP Addresses option in Google Analytics" width="427" height="144" /><br />
<span>Figure 4.</span> Traffic from the IP Addresses Option</div>
<h3>Old Google Analytics</h3>
<p>The steps for filtering by IP address are fairly similar in the old version:</p>
<ol>
<li>Log into Google Analytics</li>
<li>Click <strong>Filter Manager</strong> <em>(see Figure 5)</em></li>
<li>Click <strong>Add Filter</strong> <em>(see Figure 6)</em></li>
<li>Follow steps 6 &#8211; 10 of the beta directions</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-251" title="Screenshot showing the Filter Manager link in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter5.gif" alt="Screenshot showing the Filter Manager link in Google Analytics" width="315" height="124" /><br />
<span>Figure 5.</span> Filter Manager Link</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-252" title="Screenshot showing the Add Filter link in Google Analytics" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_GoogleAnalyticsFilter6.gif" alt="Screenshot showing the Add Filter link in Google Analytics" width="197" height="123" /><br />
<span>Figure 6.</span> Add Filter Link</div>
<h3>Keeping the Filter Updated</h3>
<p>With the filter(s) in place, we can now visit our website(s) as much as we want without worrying about messing up the stats. Unfortunately, the unwanted stats may not be blocked forever. From time to time, IP addresses may change. So we should check that everything&#39;s up to date as needed.</p>
<p>It would be nice if the filter feature provided a quick way to get our IP address and plug it into the necessary form fields. Since that&#39;s not the case, we&#39;ll need another way to get the information. Luckily there are many different options that could be used. For example, typing &quot;my ip address&quot; into the Google search box provides your public IP address.</p>
<h3>Related Links</h3>
<ul>
<li><a href="http://www.google.com/support/googleanalytics/bin/answer.py?answer=55494">How do I create a filter?</a> — provides a more in-depth description of the filter feature in Google Analytics</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-11/excluding-website-traffic-based-on-an-ip-address-in-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting HTML Data Tables Part 2: Dynamically Sort in Ascending and Descending Order</title>
		<link>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-part-2-dynamically-sort-in-ascending-and-descending-order/</link>
		<comments>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-part-2-dynamically-sort-in-ascending-and-descending-order/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 16:47:55 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=242</guid>
		<description><![CDATA[In last week&#39;s post we looked at dynamically sorting HTML data tables. But we only talked about sorting the columns in either ascending or descending. If the user is looking for a last name that appears near the end of the alphabet and the column is sorted from A to Z, they may have a [...]]]></description>
			<content:encoded><![CDATA[<p>In last week&#39;s post we looked at dynamically sorting HTML data tables. But we only talked about sorting the columns in either ascending or descending. If the user is looking for a last name that appears near the end of the alphabet and the column is sorted from A to Z, they may have a lot of names to go through before finding the one they want. Instead we could provide an option for sorting in both descending and ascending order.<span id="more-242"></span></p>
<p>So let&#39;s take final code from last week:</p>
<p><code>&lt;?php<br />
//IF THE FLAG HASN'T BEEN SET YET, SET THE DEFAULT<br />
if(!isset($_GET['orderBy'])) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
}<br />
&nbsp;<br />
//FIGURE OUT HOW TO SORT THE TABLE<br />
switch($_GET['orderBy']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = $_GET['orderBy'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = 'date DESC';<br />
}<br />
&nbsp;<br />
//GET THE LIST OF REGISTRANTS<br />
$registrantList = '';<br />
$sql = "SELECT first_name, last_name, date FROM 2011_registrants ORDER BY $sql_orderBy";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$registrantList .= '&lt;tr&gt;&lt;td&gt;' . htmlentities($row['first_name']) . '&lt;/td&gt;&lt;td&gt;' . htmlentities($row['last_name']) . '&lt;/td&gt;&lt;td&gt;' . $row['date'] . '&lt;/td&gt;&lt;/tr&gt;';<br />
}<br />
&nbsp;<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name') { print 'First Name'; }<br />
else { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'last_name') { print 'Last Name'; }<br />
else { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'date_desc') { print 'Date Registered'; }<br />
else { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<p>If you haven&#39;t done so already, you may want to review last week&#39;s post (<a href="http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-using-the-header-row-with-php/">Sorting HTML Data Tables Using the Header Row with PHP</a>) which briefly describes what each part of the code does. If you&#39;re still unsure about something, feel free to mention it in the comments section below&#8230;since there doesn&#39;t seem to be any questions, let&#39;s get rolling.</p>
<h3>Updating the Code</h3>
<p>To sort the columns in both ascending and descending order, we&#39;ll need a few more values for the order by flag. Let&#39;s start by adding them to the first name heading.</p>
<p><code>&lt;?php<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name')          { print '&lt;a href="/registrants.php?orderBy=first_name_desc"&gt;First Name&lt;img src="arrowUp.gif" alt="Ascending Order (A to Z)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'first_name_desc') { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;img src="arrowDown.gif" alt="Descending Order (Z to A)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
?&gt;</code></p>
<p>The table heading will now take one of three states:</p>
<ol>
<li>If sorting first name in ascending order, display a link to sort in descending order</li>
<li>Else&#8230;if sorting first name in descending order, display a link to sort in ascending order</li>
<li>Else&#8230;display a link to sort by whatever the default order is for that column which will be ascending order for the first name</li>
</ol>
<p>Note that the first two states contain an image that indicates the direction the column is being sorted. The third doesn&#39;t have an image since the data table is sorted by another column. Next we&#39;ll modify the other columns so they have the same setup.</p>
<p><code>&lt;?php<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name')          { print '&lt;a href="/registrants.php?orderBy=first_name_desc"&gt;First Name&lt;img src="arrowUp.gif" alt="Ascending Order (A to Z)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'first_name_desc') { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;img src="arrowDown.gif" alt="Descending Order (Z to A)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'last_name')           { print '&lt;a href="/registrants.php?orderBy=last_name_desc"&gt;Last Name&lt;img src="arrowUp.gif" alt="Ascending Order (A to Z)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'last_name_desc')  { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;img src="arrowDown.gif" alt="Descending Order (Z to A)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'date')                { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;img src="arrowUp.gif" alt="Ascending Order (Oldest to Newest)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'date_desc')       { print '&lt;a href="/registrants.php?orderBy=date"&gt;Date Registered&lt;img src="arrowDown.gif" alt="Descending Order (Newest to Oldest)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<p>We&#39;ll also need to modify the code for processing the order by flag.</p>
<p><code>&lt;?php<br />
//FIGURE OUT HOW TO SORT THE TABLE<br />
switch($_GET['orderBy']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'date':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = $_GET['orderBy'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'date_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = substr($_GET['orderBy'], 0, -5) . ' DESC';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy     = 'date DESC';<br />
}<br />
?&gt;</code></p>
<p>Now when the flag is set to &quot;date&quot;, &quot;first_name&quot;, or &quot;last_name&quot;; the SQL query sorts the data by the selected column. But if the flag is set to &quot;date_desc&quot;, &quot;first_name_desc&quot;, or &quot;last_name_desc&quot;; it sorts by the column in descending order. Note that the substr() function is there to get the column name by chopping off the last five characters (&quot;_desc&quot;). The rest of the code is the same as last week.</p>
<h3>Final Code</h3>
<p>In the end, here is what the completed code looks like all together:</p>
<p><code>&lt;?php<br />
//IF THE FLAG HASN'T BEEN SET YET, SET THE DEFAULT<br />
if(!isset($_GET['orderBy'])) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
}<br />
&nbsp;<br />
//FIGURE OUT HOW TO SORT THE TABLE<br />
switch($_GET['orderBy']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'date':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = $_GET['orderBy'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'date_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name_desc':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = substr($_GET['orderBy'], 0, -5) . ' DESC';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy     = 'date DESC';<br />
}<br />
&nbsp;<br />
//GET THE LIST OF REGISTRANTS<br />
$registrantList = '';<br />
$sql = "SELECT first_name, last_name, date FROM 2011_registrants ORDER BY $sql_orderBy";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$registrantList .= '&lt;tr&gt;&lt;td&gt;' . htmlentities($row['first_name']) . '&lt;/td&gt;&lt;td&gt;' . htmlentities($row['last_name']) . '&lt;/td&gt;&lt;td&gt;' . $row['date'] . '&lt;/td&gt;&lt;/tr&gt;';<br />
}<br />
&nbsp;<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name')          { print '&lt;a href="/registrants.php?orderBy=first_name_desc"&gt;First Name&lt;img src="arrowUp.gif" alt="Ascending Order (A to Z)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'first_name_desc') { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;img src="arrowDown.gif" alt="Descending Order (Z to A)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'last_name')           { print '&lt;a href="/registrants.php?orderBy=last_name_desc"&gt;Last Name&lt;img src="arrowUp.gif" alt="Ascending Order (A to Z)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'last_name_desc')  { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;img src="arrowDown.gif" alt="Descending Order (Z to A)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'date')                { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;img src="arrowUp.gif" alt="Ascending Order (Oldest to Newest)" /&gt;&lt;/a&gt;'; }<br />
elseif($_GET['orderBy'] == 'date_desc')       { print '&lt;a href="/registrants.php?orderBy=date"&gt;Date Registered&lt;img src="arrowDown.gif" alt="Descending Order (Newest to Oldest)" /&gt;&lt;/a&gt;'; }<br />
else                                          { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<p>With a few style sheet (CSS) declarations and a couple images, here is what our table might look like:</p>
<div class="pwn_figure"><img src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_SortHTMLTables1.gif" alt="Screenshot showing a data table&#039;s column being sorted in ascending order" title="Screenshot showing a data table&#039;s column being sorted in ascending order" width="372" height="167" class="alignnone size-full wp-image-243" /><br />
<span>Figure 1.</span> First Name Sorted in Ascending Order</div>
<div class="pwn_figure"><img src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_SortHTMLTables2.gif" alt="Screenshot showing a data table&#039;s column being sorted in descending order" title="Screenshot showing a data table&#039;s column being sorted in descending order" width="371" height="166" class="alignnone size-full wp-image-244" /><br />
<span>Figure 2.</span> Last Name Sorted in Descending Order</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-part-2-dynamically-sort-in-ascending-and-descending-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting HTML Data Tables Using the Header Row with PHP</title>
		<link>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-using-the-header-row-with-php/</link>
		<comments>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-using-the-header-row-with-php/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 00:50:50 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=240</guid>
		<description><![CDATA[When displaying a data tables, how do you usually sort the information? Do you sort by the field that you think is the most important to the visitor? For example, it&#39;s perfectly acceptable to show a list of order by date; showing the newest order first. But what if the user wants the data organized [...]]]></description>
			<content:encoded><![CDATA[<p>When displaying a data tables, how do you usually sort the information? Do you sort by the field that you think is the most important to the visitor? For example, it&#39;s perfectly acceptable to show a list of order by date; showing the newest order first. But what if the user wants the data organized differently? We could let them choose the column to sort by.<span id="more-240"></span></p>
<h3>The Example</h3>
<p>Let&#39;s say we have a MySQL table containing the conference registrations received so far and a tool has been developed for conference organizers to access the information. To make it easier for processing the registrations, the entries are listed by date submitted in reverse-chronological order. That way the newest orders appear on top.</p>
<p>The problem is that the conference organizers receive requests asking if a specific customer has registered. Having the information sorted by date makes it more difficult to find the customer in question. That&#39;s where providing an option to temporarily change the sort order can help. First, we&#39;ll need to look at the existing code.</p>
<p>Note that this post won&#39;t be showing the entire script and assumes that you have some familiarity to working with HTML, PHP, and MySQL. If you have any question, feel free to post them in the comments section below.</p>
<h3>The Existing Code</h3>
<p>First the registration information is pulled from the database, processed, and stored in the $registrantList variable to be displayed later.</p>
<p><code>&lt;?php<br />
//GET THE LIST OF REGISTRANTS<br />
$registrantList = '';<br />
$sql = "SELECT first_name, last_name, date FROM conference_registrants ORDER BY date DESC";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$registrantList .= '&lt;tr&gt;&lt;td&gt;' . htmlentities($row['first_name']) . '&lt;/td&gt;&lt;td&gt;' . htmlentities($row['last_name']) . '&lt;/td&gt;&lt;td&gt;' . $row['date'] . '&lt;/td&gt;&lt;/tr&gt;';<br />
}<br />
?&gt;</code></p>
<p>Note that the information is sorted by the &quot;date&quot; field in descending order. We&#39;ll need to figure out how to change this on the fly later. For now, the data is displayed by date.</p>
<p><code>&lt;?php<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;First Name&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;Last Name&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;Date Registered&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<p>The existing code is fairly straight forward, so hopefully everything makes sense. Let&#39;s move ahead to dynamically changing the sort order.</p>
<h3>Dynamically Changing the Sort Order</h3>
<p>As mentioned earlier, we want conference organizers to be able to sort the registrants as needed. To do that, we&#39;ll pass a flag through the program that indicates the column to sort by. So, let&#39;s add some links to the HTML table that displays the registrants. The &quot;First Name&quot; heading will look like:</p>
<p><code>&lt;?php<br />
print '&lt;th scope="col"&gt;';<br />
print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;';<br />
print '&lt;/th&gt;';<br />
?&gt;</code></p>
<p>The link points to the same page we&#39;re currently modifying and passes a GET variable called &quot;orderBy&quot; when clicked. Links are also needed for the other headings.</p>
<p><code>&lt;?php<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;';<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;';<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;';<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<p>With the flag being passed, the script needs to be modified to process it. But we should probably make sure the flag exists first. If it doesn&#39;t, the value would be defaulted to the date in descending order.</p>
<p><code>&lt;?php<br />
//IF THE FLAG HASN'T BEEN SET YET, SET THE DEFAULT<br />
if(!isset($_GET['orderBy'])) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
}<br />
?&gt;</code></p>
<p>Since the GET variable could have been tampered with, we need to make sure the value is valid. Otherwise, the program may not function as expected or worse—damage the database.</p>
<p><code>&lt;?php<br />
//FIGURE OUT HOW TO SORT THE TABLE<br />
switch($_GET['orderBy']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = $_GET['orderBy'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy     = 'date DESC';<br />
}<br />
?&gt;</code></p>
<p>In addition to the GET variable being sanitized, we now have a variable ($sql_orderBy) which will be used for the order by clause in the following SQL query:</p>
<p><code>&lt;?php<br />
//GET THE LIST OF REGISTRANTS<br />
$registrantList = '';<br />
$sql = "SELECT first_name, last_name, date FROM 2011_registrants ORDER BY $sql_orderBy";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$registrantList .= '&lt;tr&gt;&lt;td&gt;' . htmlentities($row['first_name']) . '&lt;/td&gt;&lt;td&gt;' . htmlentities($row['last_name']) . '&lt;/td&gt;&lt;td&gt;' . $row['date'] . '&lt;/td&gt;&lt;/tr&gt;';<br />
}<br />
?&gt;</code></p>
<p>With all the code in place, visitors can now sort the data by clicking the column headings. But there&#39;s still one more thing to do. When sorting by first name, for example, the &quot;First Name&quot; heading doesn&#39;t need to be clickable any more. That can be fixed by hiding the link if the orderBy flag is set to &quot;first_name&quot;.</p>
<p><code>&lt;?php<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name') { print 'First Name'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
?&gt;</code></p>
<p>As an added bonus, hiding the links provides a hint to which column the data is sorted by. We just need to do the same with the other columns.</p>
<p><code>&lt;?php<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name') { print 'First Name'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'last_name')  { print 'Last Name'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'date_desc')  { print 'Date Registered'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
<h3>Final Code</h3>
<p>In the end, here is what the completed code looks like all together:</p>
<p><code>&lt;?php<br />
//IF THE FLAG HASN'T BEEN SET YET, SET THE DEFAULT<br />
if(!isset($_GET['orderBy'])) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
}<br />
&nbsp;<br />
//FIGURE OUT HOW TO SORT THE TABLE<br />
switch($_GET['orderBy']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'first_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 'last_name':<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy = $_GET['orderBy'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$_GET['orderBy'] = 'date_desc';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$sql_orderBy     = 'date DESC';<br />
}<br />
&nbsp;<br />
//GET THE LIST OF REGISTRANTS<br />
$registrantList = '';<br />
$sql = "SELECT first_name, last_name, date FROM 2011_registrants ORDER BY $sql_orderBy";<br />
$result = mysql_query($sql);<br />
while($row = mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$registrantList .= '&lt;tr&gt;&lt;td&gt;' . htmlentities($row['first_name']) . '&lt;/td&gt;&lt;td&gt;' . htmlentities($row['last_name']) . '&lt;/td&gt;&lt;td&gt;' . $row['date'] . '&lt;/td&gt;&lt;/tr&gt;';<br />
}<br />
&nbsp;<br />
//DISPLAY THE CONFERENCE REGISTRANTS<br />
print '&lt;table cellpadding="3" cellspacing="1" border="1"&gt;';<br />
print '&lt;tr&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'first_name') { print 'First Name'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=first_name"&gt;First Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'last_name')  { print 'Last Name'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=last_name"&gt;Last Name&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;th scope="col"&gt;';<br />
if($_GET['orderBy'] == 'date_desc')  { print 'Date Registered'; }<br />
else                                 { print '&lt;a href="/registrants.php?orderBy=date_desc"&gt;Date Registered&lt;/a&gt;'; }<br />
print '&lt;/th&gt;';<br />
print '&lt;/tr&gt;';<br />
print $registrantList;<br />
print '&lt;/table&gt;';<br />
?&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-11/sorting-html-data-tables-using-the-header-row-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Archiving Old Code after Major Updates</title>
		<link>http://www.cyberscorpion.com/2011-11/archiving-old-code-after-major-updates/</link>
		<comments>http://www.cyberscorpion.com/2011-11/archiving-old-code-after-major-updates/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 23:13:57 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[managing projects]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=237</guid>
		<description><![CDATA[After making major changes to a web page what do you do with the previous version? You could toss the old code since it&#39;s unlikely to be needed again. However, that time may come. Perhaps someone discovers a critical bug that slipped through the cracks. Until fixed, it may be beneficial to revert back to [...]]]></description>
			<content:encoded><![CDATA[<p>After making major changes to a web page what do you do with the previous version? You could toss the old code since it&#39;s unlikely to be needed again. However, that time may come. Perhaps someone discovers a critical bug that slipped through the cracks. Until fixed, it may be beneficial to revert back to a fully-functional version. With that in mind, let&#39;s take a look at archiving.<span id="more-237"></span></p>
<p><img class="alignright size-full wp-image-238" title="Screenshot of an example archive folder" src="http://www.cyberscorpion.com/wp-content/uploads/2011/11/2011-11_ExampleArchiveScreenshot.gif" alt="Screenshot of an example archive folder" width="260" height="167" />If we don&#39;t use a fancy CMS (Content Management Systems) that maintains a revision history, managing the archive is our responsibility. This may sound like a daunting task, but once a process is established, it&#39;s not so bad. Of course, the magnitude of the archive will depend on factors like the size of the website, the frequency of the updates, and what&#39;s considered &quot;worthy&quot; for the archive. For example, if we&#39;re archiving files every time a typo is corrected, things might get a little unwieldy. But if we only archive code when structural changes are made, such as using a database instead of hard-coding the information&#8230;that&#39;s more manageable.</p>
<h3>Archive Structure</h3>
<p>Now we could just throw files to be archive into a folder and be done with it. But as we add more files, it&#39;s going to be difficult figuring out what&#39;s what. Instead, if we edited the index.php file under the &quot;about&quot; folder, the file would be saved to the &quot;about&quot; folder in the archive. Utilizing the same structure for the archive as in the website will make locating files faster.</p>
<h3>File Names</h3>
<p>The other thing to consider is that we may edit the index.php file under the &quot;about&quot; folder again. So we&#39;ll end up with multiple index.php files in the archive. The additional files could be renamed to index2.php, index3.php, etc. But if we&#39;re ever looking for something specific in the archives, it&#39;s going to be difficult knowing what&#39;s inside the files without opening them. So why not give our self some hints.</p>
<p>When archiving files, we can make notes within the file name. For example, we could add the date the file was archived along with a quick description of what changed. So instead of &quot;index.php&quot;, the file might be renamed to &quot;index (2011-11-07 before using a database to display staff info).php&quot;. The date, formatted as YYYY-MM-DD, is mostly used so that the file name sorts chronologically. The description would be whatever&#39;s necessary to indicate which version the file is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-11/archiving-old-code-after-major-updates/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Making Website Changes on a Copy of a File Instead of the Original</title>
		<link>http://www.cyberscorpion.com/2011-10/making-website-changes-on-a-copy-of-a-file-instead-of-the-original/</link>
		<comments>http://www.cyberscorpion.com/2011-10/making-website-changes-on-a-copy-of-a-file-instead-of-the-original/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 22:15:29 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[managing projects]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=236</guid>
		<description><![CDATA[When making major changes to a website, working on the &#34;live&#34; version of the file may be problematic. For example, if you&#39;ve been performing updates for a while only to discover that you&#39;re heading in the wrong direction. Having the original file provides a safeguard in case there&#39;s a need to go back to the [...]]]></description>
			<content:encoded><![CDATA[<p>When making major changes to a website, working on the &quot;live&quot; version of the file may be problematic. For example, if you&#39;ve been performing updates for a while only to discover that you&#39;re heading in the wrong direction. Having the original file provides a safeguard in case there&#39;s a need to go back to the drawing board. The original file is also useful for making those quick updates which crop up before the larger renovations are done. So let&#39;s look into duplicating pages for updates.<span id="more-236"></span></p>
<h3>Who the Post Is For</h3>
<p>Before getting too far, it worth saying that this post is geared towards those who manually manage their website files. If you use a Content Management System (CMS), there&#39;s probably a built-in feature for maintaining multiple copies of a page as changes are being made. Now on to the topic at hand.</p>
<h3>The Example</h3>
<p>Let&#39;s say we need to update the staff page for an organization. The employee information is currently hard-coded into the page and we want the content to be pulled from a database. Before performing the updates, we&#39;ll duplicate the staff page.</p>
<h3>Duplicate File: Same Directory</h3>
<p>As with most things involving computers, there are multiple ways to duplicate files. The original file could be opened in Adobe Dreamweaver for example. Then use the Save As feature to create a file with a different name. We could locate the file on the hard drive and duplicate it with copy/paste. Or maybe we&#39;re using a magic wand&#8230;in the end we just need a way to get two files (ex: &quot;staff.php&quot; and &quot;staff2.php&quot;). Then we can modify &quot;staff2.php&quot; to utilize the database.</p>
<p>To see the changes, we upload the new file and manually type the address (ex: http://www.example.com/about/staff2.php). But what if the page being updated needs to be connected to other pages to function properly? We could modify all the pages so they work together on a test server&#8230;or we could save the duplicate file with the same name as the original.</p>
<h3>Duplicate File: Different Directories</h3>
<p>For more integrated pages, it may be more efficient to work on a file that&#39;s named the same as the original. For example, if the page we&#39;re editing displays resources based on criteria sent via the POST method, there may be several links/forms connecting to that page. We could modify all those connections on the test server, but it might be quicker to use the same file name for the duplicate file.</p>
<p>Of course, two files with the same name can&#39;t be stored in the same directory. Instead we&#39;ll create a directory for the files being modified. We just need to remember to move the file back when we&#39;re done.</p>
<p>Note: we might want to archive the old page before moving the updated file into the &quot;live&quot; directory. But we can talk more about that next week (<a href="http://www.cyberscorpion.com/2011-11/archiving-old-code-after-major-updates/">Archiving Old Code after Major Updates</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-10/making-website-changes-on-a-copy-of-a-file-instead-of-the-original/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Sure that Updates Were Applied to a Web Page with HTML Comments</title>
		<link>http://www.cyberscorpion.com/2011-10/making-sure-that-updates-were-applied-to-a-web-page-with-html-comments/</link>
		<comments>http://www.cyberscorpion.com/2011-10/making-sure-that-updates-were-applied-to-a-web-page-with-html-comments/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 21:51:25 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[code comments]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=233</guid>
		<description><![CDATA[When modifying a website, the effects to the page are usually apparent. But when the changes only affect the backend, how do you know you&#39;re not viewing the old page? A successful update results in the same content being displayed as before the changes. Maybe the updated page was uploaded to the wrong location. Let&#39;s [...]]]></description>
			<content:encoded><![CDATA[<p>When modifying a website, the effects to the page are usually apparent. But when the changes only affect the backend, how do you know you&#39;re not viewing the old page? A successful update results in the same content being displayed as before the changes. Maybe the updated page was uploaded to the wrong location. Let&#39;s see how HTML comments can help.<span id="more-233"></span></p>
<p>Lately, I&#39;ve been replacing old hard-coded Google Analytics code used to track external links and downloadable files with a call to a user-defined function. The function reviews the link information and adds custom tracking code as necessitated by what&#39;s being linked to (see <a href="http://www.cyberscorpion.com/2010-12/future-proofing-your-google-analytics-code-for-tracking-pdfs/">Future Proofing Your Google Analytics Code for Tracking PDFs</a>). The problem is that there&#39;s no way to differentiate the hard-coded solution and the results of the user-defined function.</p>
<p>If the page being updated was on a development server, some text could be added and displayed to the page. But with a live website, it&#39;s best to avoid the visitors from seeing the test. This is where HTML comments are handy. We just need to add the following to the page:</p>
<p><code>&lt;!-- here --&gt;</code></p>
<p>Since we&#39;re using comments, the word &quot;here&quot; doesn&#39;t get displayed to the screen. Instead, it can be found in the page&#39;s source code. The code can be viewed by:</p>
<ol>
<li>Right-click the page which contains the HTML comment</li>
<li>Click
<ul>
<li><strong>View Page Source</strong> for Firefox</li>
<li><strong>View source</strong> for Internet Explorer</li>
</ul>
</li>
</ol>
<p>With the code window open, we just need to look for the text manually or by using the find feature (Ctrl + F). The HTML comment can be removed once we know we&#39;re viewing the updated code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-10/making-sure-that-updates-were-applied-to-a-web-page-with-html-comments/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Maintaining a Hidden Content Archive Within a PHP Page</title>
		<link>http://www.cyberscorpion.com/2011-10/maintaining-a-hidden-content-archive-within-a-php-page/</link>
		<comments>http://www.cyberscorpion.com/2011-10/maintaining-a-hidden-content-archive-within-a-php-page/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 20:05:48 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[code comments]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=232</guid>
		<description><![CDATA[Do you have content that cycles regularly, such as a news feed, events calendar, etc. If so, there&#39;s a good chance that the current entries would serve as useful templates for future updates. &#34;But where do I store these content templates?&#34; Hey, thanks for asking. If you normally delete old information and are unsure where/how [...]]]></description>
			<content:encoded><![CDATA[<p>Do you have content that cycles regularly, such as a news feed, events calendar, etc. If so, there&#39;s a good chance that the current entries would serve as useful templates for future updates. &quot;But where do I store these content templates?&quot; Hey, thanks for asking. If you normally delete old information and are unsure where/how to archive it, let&#39;s take a closer look at one of the methods described in last week&#39;s post (<a href="../2011-10/three-simple-methods-for-hiding-website-content-until-its-ready/">Three Simple Methods for Hiding Website Content Until It’s Ready</a>)—hiding content with PHP comments.<span id="more-232"></span></p>
<h3>The Example</h3>
<p>Let&#39;s say our website has a section listing upcoming events which might interest visitors. A subset of those events is posted on an annual basis. Updating the section typically consists of removing old entries and adding new ones as they are discovered. So how do we add a content archive?</p>
<h3>Maintaining a Content Archive</h3>
<p>Instead of deleting entries, as we may do for one-time events, the content could be hidden within the page using PHP comments. To demonstrate, here is the code for the upcoming events section:</p>
<p><code>...<br />
&lt;h1&gt;Upcoming Events&lt;/h1&gt;<br />
&lt;ul&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://uxweek.com/"&gt;UX Week&lt;/a&gt; (San Francisco, CA; Aug. 23-26, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://www.zendcon.com/"&gt;Zend PHP Conference&lt;/a&gt; (Santa Clara, CA; Oct. 17-20, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://aneventapart.com/2011/dc/"&gt;An Event Apart&lt;/a&gt; (Washington, DC; Oct. 24-26, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://futureofwebdesign.com/new-york-2011/"&gt;Future of Web Design&lt;/a&gt; (New York, NY; Nov. 7-9, 2011)&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;?php<br />
/* EVENT ARCHIVE GOES HERE<br />
...<br />
*/<br />
?&gt;<br />
...</code></p>
<p>Note the event archive between the open and close PHP tags (&lt;?php ?&gt;). Looking through the events listed above, UX Week needs to be moved to the archives:</p>
<p><code>...<br />
&lt;h1&gt;Upcoming Events&lt;/h1&gt;<br />
&lt;ul&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://www.zendcon.com/"&gt;Zend PHP Conference&lt;/a&gt; (Santa Clara, CA; Oct. 17-20, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://aneventapart.com/2011/dc/"&gt;An Event Apart&lt;/a&gt; (Washington, DC; Oct. 24-26, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://futureofwebdesign.com/new-york-2011/"&gt;Future of Web Design&lt;/a&gt; (New York, NY; Nov. 7-9, 2011)&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;?php<br />
/* EVENT ARCHIVE GOES HERE<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://uxweek.com/"&gt;UX Week&lt;/a&gt; (San Francisco, CA; Aug. 23-26, 2011)&lt;/li&gt;<br />
*/<br />
?&gt;<br />
...</code></p>
<p>In case it wasn&#39;t obvious, the UX Week entry was moved between the PHP comments (/* */). Once the page is uploaded to the server, the event information will no longer be sent to the browser. As an added bonus, we still have access to the old event information which can assist in keeping the calendar up to date.</p>
<h3>Leveraging the Archive</h3>
<p>With the archive in place, the content can be useful when looking for events. The archive contains the:</p>
<ul>
<li>Title of the events we normally post</li>
<li>Website address where we&#39;ll likely find future event information</li>
<li>Date information for the previous event which provides a clue to when the next one will be held; annual events tend to be held around the same time frame every year</li>
</ul>
<p>As upcoming event information is found, we just need to pull the corresponding entry out of the archive, customize as necessary, and post it back to the visible list.</p>
<h3>Caveats</h3>
<p>Although the above technique may sound simple, there are things to watch out for. First, the web page needing the PHP comment archive must be able to run PHP. For example, the code may not function in a .html file. PHP files typically have a .php extension. You&#39;ll also want to make sure that PHP is installed on your server.</p>
<p>When moving old event information to the archives, you&#39;ll also need to be careful of entries that contain PHP comments. For example, the following would give some unexpected results:</p>
<p><code>...<br />
&lt;h1&gt;Upcoming Events&lt;/h1&gt;<br />
&lt;ul&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://aneventapart.com/2011/dc/"&gt;An Event Apart&lt;/a&gt; (Washington, DC; Oct. 24-26, 2011)&lt;/li&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://futureofwebdesign.com/new-york-2011/"&gt;Future of Web Design&lt;/a&gt; (New York, NY; Nov. 7-9, 2011)&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;?php<br />
/* EVENT ARCHIVE GOES HERE<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://uxweek.com/"&gt;UX Week&lt;/a&gt; (San Francisco, CA; Aug. 23-26, 2011)&lt;/li&gt; /* PHP comments that will break the archive */<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;&lt;a href="http://www.zendcon.com/"&gt;Zend PHP Conference&lt;/a&gt; (Santa Clara, CA; Oct. 17-20, 2011)&lt;/li&gt;<br />
*/<br />
?&gt;<br />
...</code></p>
<p>If PHP comments don&#39;t work for whatever reason, you could look into other commenting options such as HTML comments. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-10/maintaining-a-hidden-content-archive-within-a-php-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Simple Methods for Hiding Website Content Until It&#8217;s Ready</title>
		<link>http://www.cyberscorpion.com/2011-10/three-simple-methods-for-hiding-website-content-until-its-ready/</link>
		<comments>http://www.cyberscorpion.com/2011-10/three-simple-methods-for-hiding-website-content-until-its-ready/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 23:55:39 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[code comments]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=230</guid>
		<description><![CDATA[How do you handle content that needs to be temporarily removed from a website? Maybe there is some text that gets recycled on a regular basis or something that hasn&#39;t been approved for posting yet. HTML comments could be utilized to hide everything until it&#39;s ready to go live. Just keep in mind that the [...]]]></description>
			<content:encoded><![CDATA[<p>How do you handle content that needs to be temporarily removed from a website? Maybe there is some text that gets recycled on a regular basis or something that hasn&#39;t been approved for posting yet. HTML comments could be utilized to hide everything until it&#39;s ready to go live. Just keep in mind that the content is still accessible via the browser for those who know where to look. If that&#39;s an issue, the information could be moved to a separate file and saved offline&#8230;or you could use PHP comments.<span id="more-230"></span></p>
<h3>Storing Content in a Separate File</h3>
<p>Although this may be the more cumbersome method, there are situations where it works best. If an organization has a staff page for example, entries will need to be removed as people retire, obtain employment elsewhere, etc. The information could deleted. But if someone returns, their bio information would need to be re-written and posted online again. Since it&#39;s unlikely that the people will return, it doesn&#39;t make sense to comment out the content. Instead the bios could be stored in an offline archive.</p>
<p>For more short-term removals, HTML comments could be used to hide the content until it&#39;s ready to be shown.</p>
<h3>Using HTML Comments</h3>
<p>Hiding content within the page where it will eventually be posted is beneficial since it&#39;s right where it&#39;s needed. There&#39;s no hunting down an external file for the information. With HTML comments, content is hidden by surrounding it with the comment open and close delimiters:</p>
<p><code>&lt;!-- This text will not be displayed --&gt;</code></p>
<p>Once ready, the comment delimiters can be removed to show the content.</p>
<p>The downside of using HTML comments, however, is that the content isn&#39;t technically hidden. Someone just needs to view the page&#39;s source code and locate the content of interest. If that&#39;s a concern, PHP comments might be a better fit.</p>
<h3>Using PHP Comments</h3>
<p>If we&#39;re announcing a highly-anticipated product, we wouldn&#39;t want those HTML comments to expose the information before the big reveal. PHP comments, on the other hand, don&#39;t get sent to the browser. Plus the hidden content is still stored in the same page where it&#39;s eventually displayed. To hide multiple lines of text, the following syntax could be used:</p>
<p><code>&lt;?php<br />
/*<br />
This line of text will be hidden.<br />
This line will also be hidden.<br />
*/<br />
?&gt;</code></p>
<p>Note that there are other ways to format PHP comments. More information can be found in the <a href="http://php.net/manual/en/language.basic-syntax.comments.php">PHP Manual</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-10/three-simple-methods-for-hiding-website-content-until-its-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You Haven&#8217;t Even Started Blogging and You Already Have a Typo</title>
		<link>http://www.cyberscorpion.com/2011-09/you-havent-even-started-blogging-and-you-already-have-a-typo/</link>
		<comments>http://www.cyberscorpion.com/2011-09/you-havent-even-started-blogging-and-you-already-have-a-typo/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 21:46:50 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[dates]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=227</guid>
		<description><![CDATA[There are a number of blogs out there which list dates incorrectly. It doesn&#39;t help that many of the templates built for popular blogging platforms like WordPress, display the dates incorrectly be default. If you maintain a blog, develop templates, or have ever typed out the date; please stop writing them as October 3rd, 2011. [...]]]></description>
			<content:encoded><![CDATA[<p>There are a number of blogs out there which list dates incorrectly. It doesn&#39;t help that many of the templates built for popular blogging platforms like WordPress, display the dates incorrectly be default. If you maintain a blog, develop templates, or have ever typed out the date; please stop writing them as October 3rd, 2011.<span id="more-227"></span></p>
<p><img class="alignright size-full wp-image-229" title="Graphic showing a date being corrected" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-10_OrdinalNumbersForDates.gif" alt="Graphic showing a date being corrected" width="280" height="105" />With how often dates are displayed in this way, it should be said that the &quot;rd&quot; part of the date is grammatically incorrect. If you don&#39;t believe me since&#8230;well I&#39;m a web developer—not a grammarian; check out <a href="http://grammar.quickanddirtytips.com/writing-dates.aspx">Writing Dates</a> by Grammar Girl. According to the article:</p>
<blockquote><p>&quot;There are two kinds of numbers you can use to talk about a specific day: an ordinal number and a cardinal number. Cardinal numbers represent amounts like one, two, and three. Ordinal numbers represent a place in a series like first, second, and third.&quot;</p></blockquote>
<p>The &quot;rd&quot; part may seem necessary to include. After all, we read the date as &quot;October third, two thousand eleven.&quot; But going back to the Grammar Girl article, she says:</p>
<blockquote><p>&quot;When you&#39;re writing out a date like <em>January 1, 2008</em> (in the American style), the day is a cardinal number. So you should never write <em>January 1st, 2008</em>.&quot;</p></blockquote>
<p>So now that you know the error of your ways, you&#39;re probably wondering how to fix that WordPress template.</p>
<h3>Correcting a WordPress Template</h3>
<p>For those using WordPress and are able to edit the template, you can</p>
<ol>
<li>Log into the admin panel</li>
<li>Click <strong>Appearance</strong></li>
<li>Click <strong>Editor</strong></li>
<li>Locate the files which contain the incorrect code for formatting the date</li>
<li>Fix the code</li>
<li>Click <strong>Update File</strong></li>
</ol>
<p>For example, the template file for a &quot;Single Post&quot; will likely contain a date reference. We just need to open single.php and look for code like:</p>
<p><code>&lt;?php the_time('F jS, Y') ?&gt;</code></p>
<p>and remove the &quot;S&quot;:</p>
<p><code>&lt;?php the_time('F j, Y') ?&gt;</code></p>
<p>Note: you may want to backup the template files editing any code. That way if something breaks, you can go back to the previous working version. Also, I&#39;m still learning the ins and outs of WordPress, so there&#39;s probably a better way to make changes to templates. Feel free to leave your suggestions in the comments section below.</p>
<h3>Related Links</h3>
<ul class="pwn_smDouble">
<li><a href="http://codex.wordpress.org/Formatting_Date_and_Time">WordPress Codex: Formatting Date and Time</a> – provides the list of character codes for formatting how a date is displayed in WordPress.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-09/you-havent-even-started-blogging-and-you-already-have-a-typo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Save Paper by Printing Multiple Pages to a Single Sheet with Microsoft Word</title>
		<link>http://www.cyberscorpion.com/2011-09/save-paper-by-printing-multiple-pages-to-a-single-sheet-with-microsoft-word/</link>
		<comments>http://www.cyberscorpion.com/2011-09/save-paper-by-printing-multiple-pages-to-a-single-sheet-with-microsoft-word/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 22:35:05 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Microsoft Word]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=219</guid>
		<description><![CDATA[My personal preference is to avoid printing whenever possible. It&#39;s bad for the environment, it costs businesses money, and I really like seeing my desk. But there are times when printing seems inevitable. Maybe something is needed for a meeting and you won&#39;t have a computer—or internet access. There are still ways to reduce how [...]]]></description>
			<content:encoded><![CDATA[<p>My personal preference is to avoid printing whenever possible. It&#39;s bad for the environment, it costs businesses money, and I really like seeing my desk. But there are times when printing seems inevitable. Maybe something is needed for a meeting and you won&#39;t have a computer—or internet access. There are still ways to reduce how much paper you use by printing more than one page per sheet.<span id="more-219"></span></p>
<p>The first thing you might think for printing multiple pages per sheet is to utilize both side of the paper. Although that would reduce the amount of paper used, it may be more hassle than it&#39;s worth&#8230;unless you have a duplex-capable printer. Instead we can utilize the &quot;Pages Per Sheet&quot; feature in Microsoft Word.</p>
<p>Let&#39;s say we have a four-page document to print using Word 2010. To print the entire document on a single sheet of paper, we would</p>
<ol>
<li>Open the document in Microsoft Word</li>
<li>Click <strong>File</strong> <em>(see Figure 1)</em></li>
<li>Click <strong>Print</strong> <em>(see Figure 2)</em></li>
<li>Change the &quot;1 Page Per Sheet&quot; option to &quot;4 Pages Per Sheet&quot; <em>(see Figure 3)</em></li>
<li>Click the Print button <em>(see Figure 4)</em></li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-221" title="Word 2010 screenshot showing the File menu" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2010_1.gif" alt="Word 2010 screenshot showing the File menu" width="324" height="149" /><br />
<span>Figure 1.</span> File Menu</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-222" title="Word 2010 screenshot showing the Print option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2010_2.gif" alt="Word 2010 screenshot showing the Print option" width="324" height="149" /><br />
<span>Figure 2.</span> Print Option</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-223" title="Word 2010 screenshot showing the Pages Per Sheet selection menu" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2010_3.gif" alt="Word 2010 screenshot showing the Pages Per Sheet selection menu" width="324" height="237" /><br />
<span>Figure 3.</span> Pages Per Sheet Option</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-224" title="Word 2010 screenshot showing the Print button" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2010_4.gif" alt="Word 2010 screenshot showing the Print button" width="324" height="207" /><br />
<span>Figure 4.</span> Print Button</div>
<h3>What About Older Versions of Word?</h3>
<p>The Pages Per Sheet option has been available in Microsoft Word for a while. But if you&#39;re like me, you probably didn&#39;t notice the feature since it isn&#39;t accessible through Print Preview. The option is under the Print dialog box <em>(see Figure 5 and Figure 6)</em>.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-225" title="Word 2003 screenshot showing the Pages Per Sheet option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2003.gif" alt="Word 2003 screenshot showing the Pages Per Sheet option" width="324" height="167" /><br />
<span>Figure 5.</span> Pages Per Sheet Option for Word 2003</div>
<div class="pwn_figure"><img class="alignnone size-full wp-image-226" title="Word 2007 screenshot showing the Pages Per Sheet option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_PrintingMultiplePagesWithWord2007.gif" alt="Word 2007 screenshot showing the Pages Per Sheet option" width="324" height="202" /><br />
<span>Figure 6.</span> Pages Per Sheet Option for Word 2007</div>
<h3>What If It&#39;s Not a Word Document?</h3>
<p>If you&#39;re printing something that isn&#39;t a Microsoft Word document, you could convert. Copying and pasting content into Word usually works. If formatting is an issue, you could take screenshots of the content and paste them into Word. Of course, you may want to check if the software where the content originates from doesn&#39;t already have a Pages Per Sheet option.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-09/save-paper-by-printing-multiple-pages-to-a-single-sheet-with-microsoft-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Custom Picture Thumbnails When Sharing Links on Facebook</title>
		<link>http://www.cyberscorpion.com/2011-09/using-custom-picture-thumbnails-when-sharing-links-on-facebook/</link>
		<comments>http://www.cyberscorpion.com/2011-09/using-custom-picture-thumbnails-when-sharing-links-on-facebook/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 22:32:34 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=216</guid>
		<description><![CDATA[When posting links to Facebook, the service usually searches the page for images to use along with the post. But Facebook seems to randomly ignore some pictures or fails to see any at all. If this is a common occurrence for the pages you maintain, there is a way to force Facebook to recognize an [...]]]></description>
			<content:encoded><![CDATA[<p>When posting links to Facebook, the service usually searches the page for images to use along with the post. But Facebook seems to randomly ignore some pictures or fails to see any at all. If this is a common occurrence for the pages you maintain, there is a way to force Facebook to recognize an image.<span id="more-216"></span></p>
<p><img class="alignright size-full wp-image-218" title="Facebook screenshot showing custom thumbnails" src="http://www.cyberscorpion.com/wp-content/uploads/2011/09/2011-09_CustomFacebookThumbnails.gif" alt="Facebook screenshot showing custom thumbnails" width="250" height="179" />When a picture fits well with your page content, it&#39;s probably best to include it on the page. Facebook usually locates important graphics embedded within the code. However, Facebook isn&#39;t perfect. For example, for one website I work on, Facebook only pulls in the images used for the navigation—not very useful. If you have similar problems or maybe you just don&#39;t want the picture to be included with the page, you can add the following &lt;link&gt; tag within the &lt;head&gt; section for your document:</p>
<p><code>&lt;link rel="image_src" href="/images/custom_thumb.jpg" /&gt;</code></p>
<p>Note that the href attribute should contain the path to your image. With the files uploaded to the server and the &lt;link&gt; tag in place, Facebook should now show a thumbnail for your picture.</p>
<h3>Allowing for Multiple Thumbnails</h3>
<p>One downside of this method is that once Facebook finds a &lt;link&gt; tag, it doesn&#39;t look for any other images. If other thumbnails were coming up in Facebook, such as your logo, and you want visitors to use those thumbnails instead, you might need to remove the &lt;link&gt; tag when you&#39;re done. You could also consider adding multiple &lt;link&gt; tags:</p>
<p><code>&lt;link rel="image_src" href="/images/custom_thumb.jpg" /&gt;<br />
&lt;link rel="image_src" href="/images/company_logo.jpg" /&gt;</code></p>
<h3>Problem with Facebook Caching</h3>
<p>Keep in mind that Facebook seems to cache images once they&#39;re directed to your page. So the &lt;link&gt; technique may not work if Facebook already knows about the page. There doesn&#39;t seem to be a way around the caching issue. I&#39;ve tried clearing my browser&#39;s cache, using a different browser, and using another computer with no luck. If you know of a solution, please post a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-09/using-custom-picture-thumbnails-when-sharing-links-on-facebook/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Utilizing the Short-hand if() within a PHP String</title>
		<link>http://www.cyberscorpion.com/2011-09/utilizing-the-short-hand-if-within-a-php-string/</link>
		<comments>http://www.cyberscorpion.com/2011-09/utilizing-the-short-hand-if-within-a-php-string/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 22:05:19 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=213</guid>
		<description><![CDATA[Until recently, one thing has eluded me when it comes to the Ternary Operator [aka the short-hand if()]. It&#39;s easy to assign the resulting value to a variable or to display it on the screen, but how is the short-hand if() used in conjunction with the concatenation character? In other words, how is it used [...]]]></description>
			<content:encoded><![CDATA[<p>Until recently, one thing has eluded me when it comes to the Ternary Operator [aka the short-hand if()]. It&#39;s easy to assign the resulting value to a variable or to display it on the screen, but how is the short-hand if() used in conjunction with the concatenation character? In other words, how is it used in the middle of a PHP string?<span id="more-213"></span></p>
<p>Last week&#39;s post &quot;<a href="http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/">Getting Your Projects Done Faster by Writing Less Code with the Short-hand if()</a>&quot; describes how to assign the resulting value to a variable, for example:</p>
<p><code>&lt;?php<br />
$checkbox_value1 = ($_POST['checkbox_value1']) ? 1 : 0;<br />
?&gt;</code></p>
<p>To display the value to the screen, we just need to replace the assignment part with &quot;echo&quot;:</p>
<p><code>&lt;?php<br />
echo ($_POST['checkbox_value1']) ? 1 : 0;<br />
?&gt;</code></p>
<p>What if we want to display the value in the middle of a sentence? For example, let&#39;s say we&#39;re looking to display the visitor&#39;s name (if known) within a set of instructions. We could write multiple echo statements:</p>
<p><code>&lt;?php<br />
echo 'Welcome ';<br />
echo ($visitor_name != '') ? $visitor_name : 'Guest';<br />
echo ', please use the options above to find what you are looking for.';<br />
?&gt;</code></p>
<p>However, it would be nice if we could avoid typing &quot;echo&quot; over and over again. Under normal circumstances, we would replace the extra echoes and semi-colons with the concatenation character, but that doesn&#39;t quite work in this case. We also need to surround the short-hand if() with parenthesis.</p>
<p><code>&lt;?php<br />
echo 'Welcome ' . (($visitor_name != '') ? $visitor_name : 'Guest') . ', please use the options above to find what you are looking for.';<br />
?&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-09/utilizing-the-short-hand-if-within-a-php-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Your Projects Done Faster by Writing Less Code with the Short-hand if()</title>
		<link>http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/</link>
		<comments>http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 19:21:25 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[form validation]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=212</guid>
		<description><![CDATA[Have you coded a simple if() construct that sets a variable to one of two values and thought to yourself &#34;Five lines of code; there should be a better way?&#34; Okay, maybe it&#39;s just me. Either way, let&#39;s take a look at the Ternary Operator [aka the short-hand if()]. Let&#39;s say we&#39;re processing some data [...]]]></description>
			<content:encoded><![CDATA[<p>Have you coded a simple if() construct that sets a variable to one of two values and thought to yourself &quot;Five lines of code; there should be a better way?&quot; Okay, maybe it&#39;s just me. Either way, let&#39;s take a look at the Ternary Operator [aka the short-hand if()].<span id="more-212"></span></p>
<p>Let&#39;s say we&#39;re processing some data from an HTML form and come across a checkbox value. The value could be utilized as is, but maybe we don&#39;t want to insert the word &quot;on&quot; into our database when the field is checked. Beside, who knows what that checkbox value could contain; it might be something shady. Well the following code could be used to set the checkbox value to one (1 &#8211; true) or zero (0 &#8211; false):</p>
<p><code>&lt;?php<br />
if($_POST['checkbox_value1']) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$checkbox_value1 = 1;<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$checkbox_value1 = 0;<br />
}<br />
?&gt;</code></p>
<p>However, the standard if() construct above can be a little difficult to manage, especially if there are a lot of checkboxes to validate. We could condense the code so that the entire if/else construct appears on the same line for each checkbox. But let&#39;s go even further with the <a href="http://php.net/manual/en/language.operators.comparison.php">Ternary Operator</a>:<br />
<code>&lt;?php<br />
$checkbox_value1 = ($_POST['checkbox_value1']) ? 1 : 0;<br />
?&gt;</code></p>
<p>Now that&#39;s a very compact chunk of code which is easy to scan. Once you get used to the new format, that is.</p>
<h3>Related Posts</h3>
<ul class="pwn_double">
<li><a href="http://www.cyberscorpion.com/2011-09/utilizing-the-short-hand-if-within-a-php-string/">Utilizing the Short-hand if() within a PHP String</a></li>
<li><a href="http://www.cyberscorpion.com/2011-08/condensing-if-constructs-to-improve-the-scanability-of-your-code/">Condensing if() Constructs to Improve the Scanability of Your Code</a></li>
<li><a href="http://www.cyberscorpion.com/2011-08/small-changes-to-make-if-statements-easier-to-scan/">Small Changes to Make If Statements Easier to Scan</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why You Should Utilize Separate Accounts when Managing Multiple Websites</title>
		<link>http://www.cyberscorpion.com/2011-08/why-you-should-utilize-separate-accounts-when-managing-multiple-websites/</link>
		<comments>http://www.cyberscorpion.com/2011-08/why-you-should-utilize-separate-accounts-when-managing-multiple-websites/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 22:01:34 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[managing projects]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=207</guid>
		<description><![CDATA[When setting up accounts for your job with services like web hosting, Google Analytics, etc., don&#39;t be tempted by the &#34;it will be convenient for me now&#34; argument. If you manage multiple websites, it may be easier to have all your Google Analytics reports under one Google account for example, but what if you need [...]]]></description>
			<content:encoded><![CDATA[<p>When setting up accounts for your job with services like web hosting, Google Analytics, etc., don&#39;t be tempted by the &quot;it will be convenient for me now&quot; argument. If you manage multiple websites, it may be easier to have all your Google Analytics reports under one Google account for example, but what if you need to split those websites up for some reason? If another developer takes over a website, will it be easy to turn over the keys? As in turning over the source files and account information&#8230;not emotionally. For that, you might need counseling.<span id="more-207"></span></p>
<p><img class="alignright size-full wp-image-211" title="Graphic representing how you can be locked into a single account" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_LockedIntoASingleAccount.gif" alt="Graphic representing how you can be locked into a single account" width="300" height="259" />As an in-house developer, I typically work on websites that are closely related. There is fairly little risk of needing to strip one website&#39;s account information from another. In fact, having a closer connection for these websites is more beneficial to visitors. So it makes sense that these websites be listed under the same account. However, some websites that I develop for have a greater chance of needing to be turned over to another developer. Luckily the website host we use makes it fairly simple to transfer aspects of our account. We just need to keep the websites that have a high risk of being transferred in their own sub-accounts.</p>
<p>Google Analytics, on the other hand, is not so forgiving. Once those reports are grouped together, there isn&#39;t any way to separate them. You can export specific reports, but there isn&#39;t an easy way to export all the data. You could give the new developer access to the existing analytics report. Just keep in mind that the free version of Google Analytics is limited to tracking 5 million pageviews per month and every website counts towards that total. Of course, you could signup for a Google AdWords account if you&#39;re near the limit. As long as you maintain an active AdWords account, you get unlimited pageview tracking.</p>
<h3>Related Links</h3>
<ul>
<li><a href="http://www.google.com/support/analytics/bin/answer.py?answer=55500">How do I grant other users access to my Analytics reports?</a> – instructions for sharing Google Analytics reports with other users.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-08/why-you-should-utilize-separate-accounts-when-managing-multiple-websites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Condensing if() Constructs to Improve the Scanability of Your Code</title>
		<link>http://www.cyberscorpion.com/2011-08/condensing-if-constructs-to-improve-the-scanability-of-your-code/</link>
		<comments>http://www.cyberscorpion.com/2011-08/condensing-if-constructs-to-improve-the-scanability-of-your-code/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 21:42:16 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=205</guid>
		<description><![CDATA[In a previous post, we went through the typical setup for the if() construct. The good thing (or bad) is that there&#39;s a lot of freedom when it comes to writing code. You could for example write the entire if() construct that contains dozens of lines of code and never use a line break. You [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post, we went through the typical setup for the if() construct. The good thing (or bad) is that there&#39;s a lot of freedom when it comes to writing code. You could for example write the entire if() construct that contains dozens of lines of code and never use a line break. You could, but I wouldn&#39;t necessarily recommend it. However, there are other non-&quot;standard&quot; ways of writing out your if() constructs.<span id="more-205"></span></p>
<p>When writing code, there&#39;s a good chance that you or another developer will need to modify that script down the road. Maybe you&#39;ll need to fix a bug, update outdated code, implement a new feature, etc. These types of things don&#39;t typically happen while the code is fresh in your mind, so you&#39;ll need to re-familiarize yourself with the inner workings of the program. In addition to the standard ways of making your code easy to follow along with such as using comments, it&#39;s helpful to write code that&#39;s easy to scan.</p>
<p>Let&#39;s say we have multiple if/elseif components in our script that are used to initialize a couple variables:</p>
<div class="pwn_codeBlock">&lt;?php<br />
if($verified) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pgTitle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= &#39;Thank You&#39;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$buttonLabel = &quot;;<br />
} elseif($firstSubmit) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pgTitle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= &#39;Verify Info&#39;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$buttonLabel = &#39;Submit&#39;;<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$pgTitle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= &#39;Initial Form&#39;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$buttonLabel = &#39;Continue&#39;;<br />
}<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>The above format works perfectly fine, but since the if() construct is relative short and each component essentially does the same thing, we could condense the code, making it easier to scan.</p>
<div class="pwn_codeBlock">&lt;?php<br />
if($verified)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ $pgTitle=&#39;Thank You&#39;;&nbsp;&nbsp;&nbsp;&nbsp;$buttonLabel=&quot;; }<br />
elseif($firstSubmit) { $pgTitle=&#39;Verify Info&#39;;&nbsp;&nbsp;$buttonLabel=&#39;Submit&#39;; }<br />
else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ $pgTitle=&#39;Initial Form&#39;; $buttonLabel=&#39;Continue&#39;; }<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>In addition to squishing the lines of code, you may notice that the variables have been lined up. This helps to visually indicate that they belong together.</p>
<h3>Related Posts</h3>
<ul class="pwn_double">
<li><a href="http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/">Getting Your Projects Done Faster by Writing Less Code with the Short-hand if()</a></li>
<li><a href="http://www.cyberscorpion.com/2011-08/small-changes-to-make-if-statements-easier-to-scan/">Small Changes to Make If Statements Easier to Scan</a></li>
</ul>
<p><!-- pwn_double --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-08/condensing-if-constructs-to-improve-the-scanability-of-your-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Gmail to Automatically Send Troubleshooting E-mails</title>
		<link>http://www.cyberscorpion.com/2011-08/using-gmail-to-automatically-send-troubleshooting-e-mails/</link>
		<comments>http://www.cyberscorpion.com/2011-08/using-gmail-to-automatically-send-troubleshooting-e-mails/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 22:11:45 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Communication Skills]]></category>
		<category><![CDATA[auto-responder]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=198</guid>
		<description><![CDATA[Recently, a request came through asking how to handle the troubleshooting aspect of an online seminar. Due to budget constraints, hiring someone to provide tech support was out of the question and with the event being two days away, we needed a solution quick. They were only looking to handle the problems/fixes common to the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, a request came through asking how to handle the troubleshooting aspect of an online seminar. Due to budget constraints, hiring someone to provide tech support was out of the question and with the event being two days away, we needed a solution quick. They were only looking to handle the problems/fixes common to the online seminar service we use, so my first reaction was to set up an auto-responding e-mail address.<span id="more-198"></span></p>
<p>One goal behind setting up this auto-response was to give the impression that no one was monitoring the e-mail address, so we created a brand new address. We would have preferred to use an e-mail address that ended with the organization&#39;s domain name, but we weren&#39;t able to utilize the auto-reply feature due to technical limitations. Instead we chose to use Google&#39;s Gmail service.</p>
<p>Of course our first step is to create Gmail account. But keep in mind, if you already have a Google account for their other services (Google Docs, Google Calendar, etc.) and you don&#39;t use Gmail, you might want to create the e-mail address under a different account. Otherwise Google will force you to use the new Gmail address as the primary e-mail for your account.</p>
<h3>Enabling Canned Responses</h3>
<p>After creating a Gmail account, you need to enable Canned Responses in order to indicate what auto-responder should say:</p>
<ol>
<li>Click the &quot;Labs&quot; link under the Options icon near the top-right side of the page <em>(see Figure 1)</em></li>
<li><em></em>Under Labs, locate Canned Responses and select &quot;Enable&quot; <em>(see Figure 2)</em></li>
<li>Click &quot;Save Changes&quot;</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-200" title="Gmail screenshot showing the Labs option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_GmailCannedResponse1.gif" alt="Gmail screenshot showing the Labs option" width="208" height="160" /><br />
<span>Figure 1.</span> Labs link under the Options menu</div>
<p><!-- pwn_figure --></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-201" title="Gmail screenshot showing how to enable canned responses" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_GmailCannedResponse2.gif" alt="Gmail screenshot showing how to enable canned responses" width="516" height="121" /><br />
<span>Figure 2.</span> Enable Canned Responses</div>
<p><!-- pwn_figure --></p>
<h3>Creating a Canned Response</h3>
<p>With Canned Responses enabled, a new option should be available when composing messages. Unfortunately, the process for utilizing the feature isn&#39;t very intuitive. You&#39;ll need to</p>
<ol>
<li>Click &quot;Compose mail&quot;</li>
<li>Type the text for your canned response in the message body</li>
<li>Click the &quot;Canned responses&quot; option <em>(see Figure 3)</em></li>
<li>Under the Save section, click &quot;New canned response&#8230;&quot;</li>
<li>A script prompt should pop up asking you to name the canned response <em>(see Figure 4)</em></li>
<li>Enter the name and click &quot;OK&quot;</li>
<li>Click the &quot;Discard&quot; button to cancel the message</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-202" title="Gmail screenshot showing the Canned responses option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_GmailCannedResponse3.gif" alt="Gmail screenshot showing the Canned responses option" width="435" height="146" /><br />
<span>Figure 3.</span> Canned responses option</div>
<p><!-- pwn_figure --></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-203" title="Gmail screenshot showing the script prompt which asks for the name of the canned response" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_GmailCannedResponse4.gif" alt="Gmail screenshot showing the script prompt which asks for the name of the canned response" width="498" height="137" /><br />
<span>Figure 4.</span> Script prompt asking you to name the canned response</div>
<p><!-- pwn_figure --></p>
<h3>Creating the Auto-Responder</h3>
<p>Now we can create the part which automatically responds to incoming messages. It may be tempting to use Gmail&#39;s vacation responder since it essentially does what we&#39;re looking for, but according to the fine print &quot;If a contact sends you several messages, this automated reply will be sent at most once every 4 days.&quot; Well we want the message to be sent every time, so let&#39;s create our own:</p>
<ol>
<li>Click the &quot;Mail settings&quot; link under the Options icon</li>
<li>Click &quot;Filters&quot;</li>
<li>Click &quot;Create a new filter&quot;</li>
<li>Under the &quot;Doesn&#39;t have:&quot; field type in something that will never appear in a message; maybe something like &quot;4oju!jkl@g43j&quot;</li>
<li>Click &quot;Next Step&quot;</li>
<li>Check &quot;Send canned response&quot;</li>
<li>Using the drop-down menu, choose the canned response created earlier <em>(see Figure 5)</em></li>
<li>Click &quot;Create Filter&quot;</li>
</ol>
<p>With the auto-responder in place, you&#39;ll want to make sure everything works as expected. To do so, you just need to e-mail the Gmail account.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-204" title="Gmail screenshot showing the drop-down menu for selecting a canned response" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_GmailCannedResponse5.gif" alt="Gmail screenshot showing the drop-down menu for selecting a canned response" width="498" height="229" /><br />
<span>Figure 5.</span> Choosing a canned response</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-08/using-gmail-to-automatically-send-troubleshooting-e-mails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly Switching Views for Facebook Fan Pages</title>
		<link>http://www.cyberscorpion.com/2011-08/quickly-switching-views-for-facebook-fan-pages/</link>
		<comments>http://www.cyberscorpion.com/2011-08/quickly-switching-views-for-facebook-fan-pages/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 23:53:33 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=196</guid>
		<description><![CDATA[Well it turns out that my previous post titled &#34;Facebook Fan Pages No Longer Require Switching Views to See Notifications&#34; needed to sit in the incubator a little longer. But instead of taking the blame, let&#39;s just say that Facebook updated their features shortly after my post&#8230; Notifications Area First, the previous post stated that [...]]]></description>
			<content:encoded><![CDATA[<p>Well it turns out that my previous post titled &quot;<a href="http://www.cyberscorpion.com/2011-06/facebook-fan-pages-no-longer-require-switching-views-to-see-notifications/">Facebook Fan Pages No Longer Require Switching Views to See Notifications</a>&quot; needed to sit in the incubator a little longer. But instead of taking the blame, let&#39;s just say that Facebook updated their features shortly after my post&#8230;<span id="more-196"></span></p>
<h3>Notifications Area</h3>
<p>First, the previous post stated that you still need to click the &quot;Use Facebook as &#8230;&quot; link before you can see the new people who &quot;like&quot; your organization&#39;s page. The good news is that the new Notifications area now shows all visitor interactions (new comments, Wall posts, and &quot;likes&quot;) without switching views.</p>
<h3>Switching Views</h3>
<p>The other correction involves a quicker way to switch how you view Facebook. You just need to:</p>
<ul>
<li>Log into Facebook</li>
<li>Click the &quot;Account&quot; tab near the top right</li>
<li>Click the &quot;Use Facebook as Page&quot; option <em>(See Figure 1)</em></li>
<li>Click the &quot;Switch&quot; button for the page you want use Facebook as</li>
</ul>
<p>The nice thing about this method is that it brings you directly to the page you choose. No more hunting for links to your Facebook pages.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-197" title="Use Facebook as Page Option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/08/2011-08_FacebookSwitchPageUpdate1.gif" alt="Use Facebook as Page Option" width="264" height="286" /><br />
<span>Figure 1.</span> Use Facebook as Page Option</div>
<p>Well that&#39;s all for now and I&#39;m sure the blog entries will be flawless from this point on. Oh wait, never mind, we agreed that it was Facebook that changed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-08/quickly-switching-views-for-facebook-fan-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small Changes to Make If Statements Easier to Scan</title>
		<link>http://www.cyberscorpion.com/2011-08/small-changes-to-make-if-statements-easier-to-scan/</link>
		<comments>http://www.cyberscorpion.com/2011-08/small-changes-to-make-if-statements-easier-to-scan/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 00:03:53 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=194</guid>
		<description><![CDATA[When developing programs with hundreds of lines of code, it&#39;s beneficial to write code that&#39;s easy to scan. That way when you need to update the program months or years later, it will be much easier to follow along. In addition to breaking the code into logical chunks, adding comments, etc. it&#39;s helpful to indent [...]]]></description>
			<content:encoded><![CDATA[<p>When developing programs with hundreds of lines of code, it&#39;s beneficial to write code that&#39;s easy to scan. That way when you need to update the program months or years later, it will be much easier to follow along. In addition to breaking the code into logical chunks, adding comments, etc. it&#39;s helpful to indent code which only gets executed given a specific criteria. For example, all the code within the if/else statement.<span id="more-194"></span></p>
<p>Let&#39;s say we have a page which displays an HTML form when the visitors first arrive. It then displays a thank you message once the form is submitted. We could write out the code as follows:</p>
<div class="pwn_codeBlock">&lt;?php<br />
if(isset($_POST['submit'])) {<br />
$first_name = trim($_POST['first_name']);<br />
$last_name = trim($_POST['last_name']);<br />
echo &quot;Thank you $first_name $last_name, your information was received on &quot;;<br />
echo date(&#39;F j, Y&#39;);<br />
} else {<br />
echo &#39;&lt;form method=&quot;post&quot; name=&quot;form&quot; action=&quot;"&gt;&#39;;<br />
echo &#39;&lt;label for=&quot;first_name&quot;&gt;First Name:&lt;/label&gt; &#39;;<br />
echo &#39;&lt;input type=&quot;text&quot; name=&quot;first_name&quot; id=&quot;first_name&quot; /&gt;&lt;br /&gt;&#39;;<br />
echo &#39;&lt;label for=&quot;last_name&quot;&gt;Last Name:&lt;/label&gt; &#39;;<br />
echo &#39;&lt;input type=&quot;text&quot; name=&quot;last_name&quot; id=&quot;last_name&quot; /&gt;&lt;br /&gt;&#39;;<br />
echo &#39;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send Info&quot; /&gt;&#39;;<br />
echo &#39;&lt;/form&gt;&#39;;<br />
}<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>But is there anything we can do to improve the code? It&#39;s a little difficult to figure out where the &quot;if&quot; ends and the &quot;else&quot; begins. So how does it look if we indent the lines of code within the if/else.</p>
<div class="pwn_codeBlock">&lt;?php<br />
if(isset($_POST['submit'])) {<br />
 &nbsp; &nbsp; $first_name = trim($_POST['first_name']);<br />
 &nbsp; &nbsp; $last_name = trim($_POST['last_name']);<br />
 &nbsp; &nbsp; echo &quot;Thank you $first_name $last_name, your information was received on &quot;;<br />
 &nbsp; &nbsp; echo date(&#39;F j, Y&#39;);<br />
} else {<br />
 &nbsp; &nbsp; echo &#39;&lt;form method=&quot;post&quot; name=&quot;form&quot; action=&quot;"&gt;&#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;label for=&quot;first_name&quot;&gt;First Name:&lt;/label&gt; &#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;input type=&quot;text&quot; name=&quot;first_name&quot; id=&quot;first_name&quot; /&gt;&lt;br /&gt;&#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;label for=&quot;last_name&quot;&gt;Last Name:&lt;/label&gt; &#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;input type=&quot;text&quot; name=&quot;last_name&quot; id=&quot;last_name&quot; /&gt;&lt;br /&gt;&#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send Info&quot; /&gt;&#39;;<br />
 &nbsp; &nbsp; echo &#39;&lt;/form&gt;&#39;;<br />
}<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>Now that&#39;s much easier to scan. Of course, you may want to adjust the number of spaces to indent each line of code. Instead of five spaces, like above, maybe you prefer a bigger indent.</p>
<h3>Related Posts</h3>
<ul class="pwn_double">
<li><a href="http://www.cyberscorpion.com/2011-09/getting-your-projects-done-faster-by-writing-less-code-with-the-short-hand-if/">Getting Your Projects Done Faster by Writing Less Code with the Short-hand if()</a></li>
<li><a href="http://www.cyberscorpion.com/2011-08/condensing-if-constructs-to-improve-the-scanability-of-your-code/">Condensing if() Constructs to Improve the Scanability of Your Code</a></li>
</ul>
<p><!-- pwn_double --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-08/small-changes-to-make-if-statements-easier-to-scan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Doesn&#8217;t My Submit Button Display the Entire Label: The Importance of Using Quotes with HTML Attributes</title>
		<link>http://www.cyberscorpion.com/2011-07/why-doesnt-my-submit-button-display-the-entire-label-the-importance-of-using-quotes-with-html-attributes/</link>
		<comments>http://www.cyberscorpion.com/2011-07/why-doesnt-my-submit-button-display-the-entire-label-the-importance-of-using-quotes-with-html-attributes/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 20:00:55 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=192</guid>
		<description><![CDATA[Several years back, there was a big push from the Web community to use a glorious advancement called XHTML. Although some will argue that XHTML movement was pointless, it at least changed the habits of developers like me who were a little loosey-goosey with standards. One of which is the use of quotes around all [...]]]></description>
			<content:encoded><![CDATA[<p>Several years back, there was a big push from the Web community to use a glorious advancement called XHTML. Although some will argue that XHTML movement was pointless, it at least changed the habits of developers like me who were a little loosey-goosey with standards. One of which is the use of quotes around all attributes, or lack thereof. Although the page may display fine without quotes, there are cases where the code won&#39;t work as expected.<span id="more-192"></span></p>
<p>Now if you don&#39;t enclose the attribute values with quotes, there&#39;s a fairly good chance that the page will display properly. For example, the following code displays just fine:</p>
<div class="pwn_codeBlock">&lt;p style=font-style:italic;&gt;This paragraph displays in italics&lt;/p&gt;<br />
&lt;a href=http://www.google.com/&gt;Visit Google.com&lt;/a&gt;<br />
&lt;form method=post name=form action=myform.php&gt;<br />
&lt;input type=submit name=submit value=Submit /&gt;<br />
&lt;/form&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>But what if we want the form&#39;s submit button to say &quot;Send Info&quot;:</p>
<div class="pwn_codeBlock">&lt;form method=post name=form action=myform.php&gt;<br />
&lt;input type=submit name=submit value=Send Info /&gt;<br />
&lt;/form&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>Well the button only says &quot;Send&quot;&#8230;what happened to the &quot;Info&quot; part? Without the quotes, the browser considers everything up to the first space as the value. The space basically indicates the end of one attribute name/value combination and the potential beginning of another. So it processes &quot;Info&quot; as an attribute, which ends up being invalid and ignored. In order to specify that both words should be used as the label, we need quotes:</p>
<div class="pwn_codeBlock">&lt;form method=post name=form action=myform.php&gt;<br />
&lt;input type=submit name=submit value=&quot;Send Info&quot; /&gt;<br />
&lt;/form&gt;</div>
<p><!-- pwn_codeBlock --><br />
Note that I would also recommend using quotes for the other attributes, but I&#39;m sure you can handle that part.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-07/why-doesnt-my-submit-button-display-the-entire-label-the-importance-of-using-quotes-with-html-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing Database Entries on the Fly by Embedding PHP Variables</title>
		<link>http://www.cyberscorpion.com/2011-07/changing-database-entries-on-the-fly-by-embedding-php-variables/</link>
		<comments>http://www.cyberscorpion.com/2011-07/changing-database-entries-on-the-fly-by-embedding-php-variables/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 22:41:13 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=191</guid>
		<description><![CDATA[When pulling information from a database, have you ever needed to change aspects of the text on the fly. For example, let&#39;s say you have a form which is populated from a database with questions like &#34;Did you utilize any of the website resources in 2011?&#34; If the form is submitted annually, the 2011 needs [...]]]></description>
			<content:encoded><![CDATA[<p>When pulling information from a database, have you ever needed to change aspects of the text on the fly. For example, let&#39;s say you have a form which is populated from a database with questions like &quot;Did you utilize any of the website resources in 2011?&quot; If the form is submitted annually, the 2011 needs to correspond with the year the form is being filled out by visitors. You could remove the year, but what if the question becomes too vague without it. In a perfect world, we could store a PHP variable in the database along with the question, but we can&#39;t do that&#8230;can we?<span id="more-191"></span></p>
<p>If we could utilize PHP variables, our database entry for the question mentioned earlier would be modified to something like this:</p>
<div class="pwn_codeBlock">Did you utilize any of the website resources in $survey_year?</div>
<p><!-- pwn_codeBlock --><br />
Of course if we displayed the question as is, PHP wouldn&#39;t know about the variable. Instead it displays the text exactly as it appears in the database. But with a little manual intervention, we can use the variable as a placeholder. We just need replace all occurrences of the $survey_year with the true value using the <a href="http://php.net/manual/en/function.str-replace.php">str_replace()</a> function.</p>
<div class="pwn_codeBlock">$survey_year = &#39;2011&#39;;<br />
$current_question = &#39;Did you utilize any of the website resources in $survey_year?&#39;;<br />
$current_question = str_replace(&#39;$survey_year&#39;, $survey_year, $current_question);</div>
<p><!-- pwn_codeBlock --><br />
Note that the first argument of str_rplace() is enclosed in single quotes which prevents PHP from interpreting the variable before the string replacement happens.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-07/changing-database-entries-on-the-fly-by-embedding-php-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modify Automated Information When Sharing Links on Facebook</title>
		<link>http://www.cyberscorpion.com/2011-07/modify-automated-information-when-sharing-links-on-facebook/</link>
		<comments>http://www.cyberscorpion.com/2011-07/modify-automated-information-when-sharing-links-on-facebook/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 02:03:56 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=186</guid>
		<description><![CDATA[When sharing links to Facebook, did you know that you can modify the title and description chosen for the link? Facebook usually does a decent job pulling this information from the website, but what if it doesn&#39;t. Or maybe you want the description to focus on another aspect of the page. Well with a few [...]]]></description>
			<content:encoded><![CDATA[<p>When sharing links to Facebook, did you know that you can modify the title and description chosen for the link? Facebook usually does a decent job pulling this information from the website, but what if it doesn&#39;t. Or maybe you want the description to focus on another aspect of the page. Well with a few easy steps, you can show Facebook who&#39;s boss&#8230;kind of.<span id="more-186"></span></p>
<p>Before we can modify anything, we need to start the process for posting a link:</p>
<ol>
<li>Log into Facebook</li>
<li>Click the &quot;Link&quot; option where you normally enter status updates <em>(see Figure 1)</em></li>
<li>Enter the link and click the &quot;Attach&quot; button</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-188" title="Facebook Post Link Option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/07/2011-07_FacebookChangeLinkText1.gif" alt="Facebook Post Link Option" width="585" height="158" /><br />
<span>Figure 1.</span> Facebook&#39;s Share Link Option</div>
<p>After clicking the &quot;Attach&quot; button, Facebook performs it&#39;s magic to retrieve the page title, description, and pictures associated with the link. Changing the image is fairly straightforward, but it isn&#39;t as obvious that the title and description can be modified.</p>
<p>Let&#39;s say you&#39;re sharing a link to&#8230;o&#39; I don&#39;t know, <a href="http://www.cyberscorpion.com/">www.cyberscorpion.com</a>. But for some reason Facebook chooses a description from an older post<em></em>. To update the text, we just click the description as shown in Figure 2.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-189" title="Facebook - Modify Link Example" src="http://www.cyberscorpion.com/wp-content/uploads/2011/07/2011-07_FacebookChangeLinkText2.gif" alt="Facebook - Modify Link Example" width="565" height="313" /><br />
<span>Figure 2.</span> Modify Link Example</div>
<p>Once the information has been customized to fit your needs, you can fill in the &quot;Say something about this link&#8230;&quot; box and click the &quot;Share&quot; button.</p>
<h3>Missing Description</h3>
<p>Occasionally Facebook can&#39;t find a description. Maybe it was inaccessible because the text was stored in an image or maybe the page just doesn&#39;t have a description. Whatever the reason, you can still edit the description. If you hover the mouse cursor over where the first couple of letters would be, the description area should turn colors <em>(see Figure 3)</em>. Clicking the yellow box will allow you to add a description.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-190" title="Facebook - Missing Description" src="http://www.cyberscorpion.com/wp-content/uploads/2011/07/2011-07_FacebookChangeLinkText3.gif" alt="Facebook - Missing Description" width="573" height="278" /><br />
<span>Figure 3.</span> Facebook Description Field</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-07/modify-automated-information-when-sharing-links-on-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reduce Website Maintenance by Importing Common Contact Information with PHP</title>
		<link>http://www.cyberscorpion.com/2011-07/reduce-website-maintenance-by-importing-common-contact-information-with-php/</link>
		<comments>http://www.cyberscorpion.com/2011-07/reduce-website-maintenance-by-importing-common-contact-information-with-php/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 22:10:29 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=184</guid>
		<description><![CDATA[While working on websites, one thing I&#39;ve learned over the years is that change happens. People will leave the organization. Organizations change names. When change occurs, the thing we need to keep in mind is how that change affects the website. For example, if someone retires and their contact information is listed dozens or hundreds [...]]]></description>
			<content:encoded><![CDATA[<p>While working on websites, one thing I&#39;ve learned over the years is that change happens. People will leave the organization. Organizations change names. When change occurs, the thing we need to keep in mind is how that change affects the website. For example, if someone retires and their contact information is listed dozens or hundreds throughout the website, it&#39;s going to take a while to update everything. But this type issue could be avoided. Instead of hard-coding the information everywhere, why not import it using PHP.<span id="more-184"></span></p>
<h3>Using a Database</h3>
<p>Now the information could be stored in a database. For example, maybe you have a table containing all the staff information for your organization. With a quick query, you could pull Sally Joe&#39;s contact information for any pages that need it. Then if her e-mail address changes, you only need to update the database. But what happens if Sally leaves the organization? If you&#39;re pulling the information based on an ID number, you may still need to go through the website and replace each query with the new ID.</p>
<p>Also, a database may be overkill for importing something very specific like the organization&#39;s name or a common phrase to be used throughout the website. So let&#39;s take a look at some other options for importing content.</p>
<h3>PHP&#39;s include() or require()</h3>
<p>Common information could be stored in an external file and imported using an <a href="http://php.net/manual/en/function.include.php">include()</a> or <a href="http://www.php.net/manual/en/function.require.php">require()</a> statement. For example, let&#39;s create a file called &quot;include_WebmasterContactInfo.html&quot; which contains the following:</p>
<div class="pwn_codeBlock">please e-mail &lt;a href=&quot;mailto:webmaster@yourwebsite.com&quot;&gt;webmaster@yourwebsite.com&lt;/a&gt;.</div>
<p><!-- pwn_codeBlock --></p>
<p>We could then grab the information with the following code:</p>
<div class="pwn_codeBlock">echo &quot;&lt;p&gt;The registration form is temporarily unavailable. If you have any questions, &quot;;<br />
include &#39;include_WebmasterContactInfo.html&#39;;<br />
echo &quot;&lt;/p&gt;&quot;;</div>
<p><!-- pwn_codeBlock --></p>
<p>As a result, the website will display &quot;The registration form is temporarily unavailable. If you have any questions, please e-mail <a href="#">webmaster@yourwebsite.com</a>.&quot;</p>
<p>The downside of including information this way is that it&#39;s imported as is. In the previous example, to display the information multiple times on the same page, we would need to execute the include statement every time. However, we could modify include_WebmasterContactInfo.html so that it doesn&#39;t echo directly to the screen. Instead the information could be assigned to a variable:</p>
<div class="pwn_codeBlock">$contact_info = &#39;please e-mail &lt;a href=&quot;mailto:webmaster@yourwebsite.com&quot;&gt;webmaster@yourwebsite.com&lt;/a&gt;.&#39;;</div>
<p><!-- pwn_codeBlock --></p>
<p>Now we can import the new variable and use it throughout our page. Note that the include() statement needs to be executed before the variable can be used.</p>
<div class="pwn_codeBlock">include &#39;include_WebmasterContactInfo.html&#39;;<br />
echo &quot;&lt;p&gt;The registration form is temporarily unavailable. If you have any questions, $contact_info&lt;/p&gt;&quot;;</div>
<p><!-- pwn_codeBlock --></p>
<h3>PHP&#39;s file_get_contents()</h3>
<p>Another option for importing information is the <a href="http://us.php.net/manual/en/function.file-get-contents.php">file_get_contents()</a> function. So if our include_WebmasterContactInfo.html looks like the following:</p>
<div class="pwn_codeBlock">please e-mail &lt;a href=&quot;mailto:webmaster@yourwebsite.com&quot;&gt;webmaster@yourwebsite.com&lt;/a&gt;.</div>
<p><!-- pwn_codeBlock --></p>
<p>We could display the content directly to the screen:</p>
<div class="pwn_codeBlock">echo &quot;&lt;p&gt;The registration form is temporarily unavailable. If you have any questions, &quot;;<br />
echo file_get_contents(&#39;include_WebmasterContactInfo.html&#39;);<br />
echo &quot;&lt;/p&gt;&quot;;</div>
<p><!-- pwn_codeBlock --></p>
<p>Or we could create a variable using the function:</p>
<div class="pwn_codeBlock">$contact_info = file_get_contents(&#39;include_WebmasterContactInfo.html&#39;);<br />
echo &quot;&lt;p&gt;The registration form is temporarily unavailable. If you have any questions, $contact_info&lt;/p&gt;&quot;;</div>
<p><!-- pwn_codeBlock --></p>
<p>The benefit of using file_get_contents() is that you can create the variable on the fly. You also don&#39;t need to remember what the variable was called in the file being included.</p>
<h3>Related Posts</h3>
<ul class="pwn_double">
<li><a href="http://www.cyberscorpion.com/2011-01/developing-a-simple-website-template-with-php/">Developing a Simple Website Template with PHP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-07/reduce-website-maintenance-by-importing-common-contact-information-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PHP to Dynamically Hide Content after an Expiration Date</title>
		<link>http://www.cyberscorpion.com/2011-06/using-php-to-dynamically-hide-content-after-an-expiration-date/</link>
		<comments>http://www.cyberscorpion.com/2011-06/using-php-to-dynamically-hide-content-after-an-expiration-date/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 22:05:56 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[deadlines]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=181</guid>
		<description><![CDATA[If you need to pull something offline by a specific date, what happens when no one&#39;s around to remove the content? People get sick or maybe a deadline was overlooked and you&#39;re out of the office. Well you could just suck it up, go into work, and remove the registration form from the website. Or [...]]]></description>
			<content:encoded><![CDATA[<p>If you need to pull something offline by a specific date, what happens when no one&#39;s around to remove the content? People get sick or maybe a deadline was overlooked and you&#39;re out of the office. Well you could just suck it up, go into work, and remove the registration form from the website. Or you could write a little PHP code to disable the form (or any other information) for you.<span id="more-181"></span></p>
<p>Before getting into any code, it should be said that you&#39;ll need access to a web server that supports PHP for the following solution to work. It&#39;s also helpful if you have a basic knowledge of how PHP works. Of course, if you have any questions feel free to post them in the comments section. Now on to the code.</p>
<p>Since we&#39;ll be dealing with dates, it&#39;s a good idea to set the time zone. For this example, we&#39;ll use U.S. Central time:</p>
<div class="pwn_codeBlock">date_default_timezone_set(&#39;America/Chicago&#39;);</div>
<p><!-- pwn_codeBlock --></p>
<p>We&#39;ll also need a couple variables to store the current and deadline timestamps:</p>
<div class="pwn_codeBlock">$current_ts = time();<br />
$deadline_ts = mktime(0,0,0,5,1,2011);</div>
<p><!-- pwn_codeBlock --></p>
<p>Now let&#39;s say we have a registration form that needs to be disabled after the deadline which was set above to May 1, 2011. To do that, we need to see if the current timestamp is greater than the deadline. If it is, we&#39;ll let the user know that we&#39;re no longer accepting registrations. Otherwise the registration form is shown.</p>
<div class="pwn_codeBlock">if($current_ts > $deadline_ts) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//message about the form being disabled<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//code for the registration form<br />
}</div>
<p><!-- pwn_codeBlock --></p>
<p>With the code in place, it&#39;s a good idea to make sure it works. Since we don&#39;t have a time machine, we&#39;ll need to find another way to change the current timestamp. Let&#39;s use the mktime() function again:</p>
<div class="pwn_codeBlock">$current_ts = time();<br />
$current_ts = mktime(0,0,0,5,1,2011);</div>
<p><!-- pwn_codeBlock --></p>
<p>You can now test whatever date you want by changing the mktime() function arguments. When testing, make sure that at least one date before, during, and after the deadline date works.</p>
<h3>Final Code</h3>
<div class="pwn_codeBlock">//SET THE TIME ZONE<br />
date_default_timezone_set(&#39;America/Chicago&#39;);</p>
<p>//CREATE TIMESTAMP VARIABLES<br />
$current_ts = time();<br />
$deadline_ts = mktime(0,0,0,5,1,2011);</p>
<p>//IF THE DEADLINE HAS PASSED, LET USER KNOW&#8230;ELSE, DISPLAY THE REGISTRATION FORM<br />
if($current_ts > $deadline_ts) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//message about the form being disabled<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//code for the registration form<br />
}</p></div>
<p><!-- pwn_codeBlock --></p>
<h3>Related Resources</h3>
<ul class="pwn_double">
<li><a href="http://php.net/manual/en/function.date-default-timezone-set.php">PHP Manual: date_default_timezone_set()</a> &ndash; describes the date_default_timezone_set() function</li>
<li><a href="http://www.php.net/manual/en/timezones.php">PHP Manual: Time Zones</a> &ndash; provides a list of supported time zones</li>
<li><a href="http://us.php.net/manual/en/function.time.php">PHP Manual: time()</a> &ndash; describes the time() function</li>
<li><a href="http://us.php.net/manual/en/function.mktime.php">PHP Manual: mktime()</a> &ndash; describes the mktime() function</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-06/using-php-to-dynamically-hide-content-after-an-expiration-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avoiding Deadlines on the Weekend</title>
		<link>http://www.cyberscorpion.com/2011-06/avoiding-deadlines-on-the-weekends/</link>
		<comments>http://www.cyberscorpion.com/2011-06/avoiding-deadlines-on-the-weekends/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 22:32:27 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Communication Skills]]></category>
		<category><![CDATA[deadlines]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=148</guid>
		<description><![CDATA[If you&#39;ve ever posted an event registration form or some other time-sensitive information to your website, there&#39;s a good chance that you&#39;ve dealt with deadlines. More specifically the deadlines we impose on website visitors. Well what happens if you&#39;re not around on the specified date and someone need assistance? Who takes the registration form offline? [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#39;ve ever posted an event registration form or some other time-sensitive information to your website, there&#39;s a good chance that you&#39;ve dealt with deadlines. More specifically the deadlines we impose on website visitors. Well what happens if you&#39;re not around on the specified date and someone need assistance? Who takes the registration form offline? What if the website breaks? These are all things that need to be considered when planning a project.<span id="more-148"></span></p>
<p><img class="alignright size-full wp-image-180" title="Calendar Graphic" src="http://www.cyberscorpion.com/wp-content/uploads/2011/06/2011-06_AvoidingWeekendDeadlines.gif" alt="Calendar Graphic" width="250" height="215" />Over the years, there have been multiple occasions where my projects have been assigned a Saturday deadline. No one meant to choose a date when everyone was out of the office, it just happened that way. Nobody really noticed the issue either until it was too late. Of course, the world isn&#39;t going to end just because a deadline was scheduled when no one&#39;s around to help with support. Depending on your website, things will likely work as expected. But there will be occasions where something goes wrong.</p>
<p>For example, I developed a submission program where visitors can create a login account, submit some overview information, and upload a document later in the year. Since there may be months between when the customer creates their login and when they upload the document, we tend to get a number of requests for their login credentials. So if you combine that with the likelihood of last-minute submissions, having a deadline when no one&#39;s in the office poses a slight problem.</p>
<h3>What Do You Do?</h3>
<p>How you handle deadlines, as with most things, depends on the possible outcomes. If there&#39;s a history of support requests surrounding a specific project, you&#39;ll want to be involved in the planning process or at least double check the chosen deadline. Maybe it can be changed. Whether or not the deadline works, it&#39;s a good idea to find someone else as a backup. That way it doesn&#39;t matter if you&#39;re on vacation or sick. At least someone will be around to assist. Or maybe it just comes down to sucking it up and working on your time off.</p>
<p>However, if you just need to remove something from your website after the deadline, you&#39;ll want to stay tuned. Next week&#39;s post (<a href="http://www.cyberscorpion.com/2011-06/using-php-to-dynamically-hide-content-after-an-expiration-date/">Using PHP to Dynamically Hide Content after an Expiration Date</a>) will focus on some PHP code to close a registration form and/or disable aspects of the page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-06/avoiding-deadlines-on-the-weekends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook Fan Pages No Longer Require Switching Views to See Notifications</title>
		<link>http://www.cyberscorpion.com/2011-06/facebook-fan-pages-no-longer-require-switching-views-to-see-notifications/</link>
		<comments>http://www.cyberscorpion.com/2011-06/facebook-fan-pages-no-longer-require-switching-views-to-see-notifications/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 21:10:47 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=175</guid>
		<description><![CDATA[If you manage a Facebook &#34;fan&#34; page, you&#39;re probably aware that a feature was added earlier this year which notifies us when people comment on our page or post something to our wall. Before seeing these notifications though, we needed to click that &#34;Use Facebook as Your Organization&#39;s Name&#34; link. But Facebook recently changed the [...]]]></description>
			<content:encoded><![CDATA[<p>If you manage a Facebook &quot;fan&quot; page, you&#39;re probably aware that a feature was added earlier this year which notifies us when people comment on our page or post something to our wall. Before seeing these notifications though, we needed to click that &quot;Use Facebook as <em>Your Organization&#39;s Name</em>&quot; link. But Facebook recently changed the process&#8230;for the better.<span id="more-175"></span></p>
<p>To see the new notifications feature in action, log into your Facebook account and visit the various fan pages you manage. You should see the &quot;Notifications&quot; link in the right column under &quot;Use Facebook as <em>Your Organization&#39;s Name</em>&quot; as shown in Figure 1. If you have any messages, you can click the notifications link to view them. <em>(See Figure 2)</em></p>
<div class="pwn_figure"><img class="size-full wp-image-176 alignnone" title="Facebook Option to View Notifications" src="http://www.cyberscorpion.com/wp-content/uploads/2011/06/2011-06_FacebookNotifications1.jpg" alt="Facebook Option to View Notifications" width="333" height="165" /><br />
<span>Figure 1.</span> New Notifications Option</div>
<p>&nbsp;</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-177" title="Facebook Showing New Notifications" src="http://www.cyberscorpion.com/wp-content/uploads/2011/06/2011-06_FacebookNotifications2.jpg" alt="Facebook Showing New Notifications" width="428" height="159" /><br />
<span>Figure 2.</span> Showing Notifications</div>
<p><!-- pwn_figure --><br />
Note that you&#39;ll still need to click the &quot;Use Facebook as &#8230;&quot; link to see the list of new people who &quot;like&quot; your page.</p>
<h3>What Do You Mean Better?</h3>
<p>As hinted at earlier, the recent update improved my work flow. It&#39;s a minor improvement, but it helped none the less. When managing multiple fan pages, here was the typical process:</p>
<ol>
<li>Log into Facebook</li>
<li>Visit the first fan page</li>
<li>Click the &quot;Use Facebook as &#8230;&quot; link</li>
<li>Process any new notifications</li>
<li>Click the &quot;Use Facebook as Patrick&quot; link</li>
<li>Visit another fan page</li>
<li>Repeat steps 3-6 until all Facebook pages have been reviewed</li>
</ol>
<p>Beyond the extra steps required to process notifications, there is a minor issue with switching between using Facebook as an organization and myself. Whenever I forget to click the &quot;Use Facebook as Patrick&quot; link before going to the next fan page, the right column that provides all the admin options goes blank.</p>
<p>Of course, there is an option to &quot;Switch back to Patrick&quot; under the Account tab at the top <em>(See Figure 3)</em>, but this sends me back to the news feed for my personal Facebook page. So the best option appears to be going back to the organization&#39;s page that I&#39;m still logged in as and clicking the link to use Facebook as myself.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-178" title="Facebook Account Tab" src="http://www.cyberscorpion.com/wp-content/uploads/2011/06/2011-06_FacebookNotifications3.jpg" alt="Facebook Account Tab" width="376" height="244" /><br />
<span>Figure 3.</span> Facebook Account Tab</div>
<p>&nbsp;</p>
<h3>Related Posts</h3>
<ul class="pwn_double">
<li><a href="http://www.cyberscorpion.com/2011-02/facebook-pages-for-organizations-now-easier-to-manage-due-to-recent-update/">Facebook Pages for Organizations Now Easier to Manage Due to Recent Update</a> – post about the notifications feature which was added to fan pages back in February 2011</li>
<li><a href="http://www.cyberscorpion.com/2011-08/quickly-switching-views-for-facebook-fan-pages/">Quickly Switching Views for Facebook Fan Pages</a> – an update to the above post which corrects a few inaccuracies</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-06/facebook-fan-pages-no-longer-require-switching-views-to-see-notifications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asking Spammer to Stop E-mailing: What&#8217;s the Point</title>
		<link>http://www.cyberscorpion.com/2011-06/asking-spammer-to-stop-e-mailing-whats-the-point/</link>
		<comments>http://www.cyberscorpion.com/2011-06/asking-spammer-to-stop-e-mailing-whats-the-point/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 02:10:58 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=169</guid>
		<description><![CDATA[Given how long e-mail spam has plagued our inboxes, it surprises me that people still get up in arms over it. If someone needs you to sneak their fortune out of the country or attempts to sell you &#34;Viagra&#34;, what do you expect to happen when you ask to be removed from their mailing list. Do you really think they care. In some cases all you&#39;re [...]]]></description>
			<content:encoded><![CDATA[<p>Given how long e-mail spam has plagued our inboxes, it surprises me that people still get up in arms over it. If someone needs you to sneak their fortune out of the country or attempts to sell you &quot;Viagra&quot;, what do you expect to happen when you ask to be removed from their mailing list. Do you really think they care. In some cases all you&#39;re doing is confirming that your e-mail account is active. Then they&#39;ll send more spam and/or sell your e-mail address to other spammers.<span id="more-169"></span></p>
<p><img class="alignright size-full wp-image-174" title="Sample responses to spam" src="http://www.cyberscorpion.com/wp-content/uploads/2011/06/2011-06_RespondingToSpam.jpg" alt="Sample responses to spam" width="250" height="316" />Over the past week, I was included in an interesting exchange through a mailing list created by a spammer. After sending out the spam message, several recipients asked to be removed from the list. But since they responded through a mailing list everyone got the message causing even more anger and confusion. They started e-mailing messages like &quot;Why are you e-mailing me, this is my work place, I don&#39;t know you.&quot; and &quot;A complaint will be lodged with the authorities if you do not cease your actions.&quot;</p>
<p>In the end nobody really wins except the spammer. Don&#39;t get me wrong, spam is annoying. Living in a world where we&#39;re not bombarded with get-rich-quick schemes, e-cigarette sales, etc. would be ideal. But I&#39;m not holding my breath.</p>
<p>In the meantime, we need to live with whatever spam-prevention solutions are available to us. We also have the handy delete key for those pesky messages that make it through the filters. It takes less than a second. And you may even save yourself from more spam.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-06/asking-spammer-to-stop-e-mailing-whats-the-point/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Maintaining Line Breaks When Copying Code from PHPFreaks.com</title>
		<link>http://www.cyberscorpion.com/2011-05/maintaining-line-breaks-when-coping-code-from-phpfreaks-com/</link>
		<comments>http://www.cyberscorpion.com/2011-05/maintaining-line-breaks-when-coping-code-from-phpfreaks-com/#comments</comments>
		<pubDate>Mon, 30 May 2011 19:05:45 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Freaks]]></category>
		<category><![CDATA[WordPad]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=166</guid>
		<description><![CDATA[While helping people on PHPFreaks.com, I tend to have issues copying code from their forum and pasting it into Dreamweaver. For some reason all the line breaks are removed from the code. As much as I love manually adding dozens of line breaks back into the code, there has to be a quicker solution. For those using Microsoft Windows, you [...]]]></description>
			<content:encoded><![CDATA[<p>While helping people on PHPFreaks.com, I tend to have issues copying code from their forum and pasting it into Dreamweaver. For some reason all the line breaks are removed from the code. As much as I love manually adding dozens of line breaks back into the code, there has to be a quicker solution.<span id="more-166"></span></p>
<p>For those using Microsoft Windows, you may have a software application called WordPad. Mine was located in the Start menu under All Programs &gt; Accessories. With this application, all you need to do is</p>
<ol>
<li>Copy the code from PHPFreaks</li>
<li>Paste it into WordPad</li>
<li>Copy it from WordPad</li>
<li>Paste it into Dreamweaver</li>
</ol>
<p>As far as I can tell there isn&#39;t anything special about WordPad other than it maintains the line breaks when copying code. Also, I&#39;m sure that this particular issue isn&#39;t specific to PHPFreaks or Dreamweaver. I would imagine that other discussion forums where code is posted will have user&#39;s experiencing the same problem.</p>
<h3>Related Resources</h3>
<ul>
<li><a href="http://www.phpfreaks.com/forums/">PHPFreaks.com</a> – a discussion forum for getting help with PHP, MySQL, and other Web-related topics. Note that I&#39;m cyberRobot on the forum.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-05/maintaining-line-breaks-when-coping-code-from-phpfreaks-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto-closing the Files Panel in Dreamweaver</title>
		<link>http://www.cyberscorpion.com/2011-05/auto-closing-the-files-panel-in-dreamweaver/</link>
		<comments>http://www.cyberscorpion.com/2011-05/auto-closing-the-files-panel-in-dreamweaver/#comments</comments>
		<pubDate>Tue, 24 May 2011 00:36:44 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=160</guid>
		<description><![CDATA[A few months back the Files panel in Adobe Dreamweaver CS4 began acting up for me. Normally it would minimize after clicking outside of the panel, but for some reason it decided to stop working. I&#39;ve spent more time then I care to admit digging through preferences and searching for answers online. Of course, once I stopped looking, the solution presented itself. [...]]]></description>
			<content:encoded><![CDATA[<p>A few months back the Files panel in Adobe Dreamweaver CS4 began acting up for me. Normally it would minimize after clicking outside of the panel, but for some reason it decided to stop working. I&#39;ve spent more time then I care to admit digging through preferences and searching for answers online. Of course, once I stopped looking, the solution presented itself.<span id="more-160"></span></p>
<h3>Background</h3>
<p>In Dreamweaver my Files panel is collapsed down so that it only shows an icon. <em>(See Figure 1)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-162" title="Dreamweaver Screenshot - Files Panel Collapsed to Icons" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_DreamweaverFilesPanel1.gif" alt="Dreamweaver Screenshot - Files Panel Collapsed to Icons" width="216" height="149" /><br />
<span>Figure 1.</span> Files Panel Collapsed to an Icon</div>
<p><!-- pwn_figure --></p>
<p>To access my files, I just click the Files icon. But as mentioned earlier the panel wouldn&#39;t go away without clicking the Files icon again. <em>(See Figure 2)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-163" title="Dreamweaver Screenshot - View After Clicking the Files Icon" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_DreamweaverFilesPanel2.gif" alt="Dreamweaver Screenshot - View After Clicking the Files Icon" width="449" height="235" /><br />
<span>Figure 2.</span> View After Clicking the Files Icon</div>
<p><!-- pwn_figure --></p>
<h3>Fixing the Auto-Close Feature</h3>
<p>It turns out that there is a setting for the auto-close feature, but it&#39;s location isn&#39;t very obvious. If you right-click the Files panel, you should see an option for &quot;Auto-Collapse Iconic Panels&quot;. You just need to make sure the option is checked. <em>(See Figure 3)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-164" title="Dreamweaver Screenshot - Files Panel Options" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_DreamweaverFilesPanel3.gif" alt="Dreamweaver Screenshot - Files Panel Options" width="316" height="181" /><br />
<span>Figure 3.</span> Auto-Collapse Iconic Panels Option</div>
<p><!-- pwn_figure --></p>
<h3>Switching to Icon View</h3>
<p>If you want to switch your Files panel so that it&#39;s collapsed down to an icon, you just need to click the double-arrow icon above the Files panel. <em>(See Figure 4)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-165" title="Dreamweaver Screenshot - Expanded View" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_DreamweaverFilesPanel4.gif" alt="Dreamweaver Screenshot - Expanded View" width="334" height="224" /><br />
<span>Figure 4.</span> Expanded Files Panel and the Button to Collapse to Icons</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-05/auto-closing-the-files-panel-in-dreamweaver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What the .filepart Extension Means When Downloading Files with WinSCP</title>
		<link>http://www.cyberscorpion.com/2011-05/what-the-filepart-extension-means-when-downloading-files-with-winscp/</link>
		<comments>http://www.cyberscorpion.com/2011-05/what-the-filepart-extension-means-when-downloading-files-with-winscp/#comments</comments>
		<pubDate>Mon, 16 May 2011 22:53:45 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Secure FTP]]></category>
		<category><![CDATA[WinSCP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=158</guid>
		<description><![CDATA[One thing about downloading files with WinSCP using Secure FTP (SFTP) is that sometimes it adds &#34;.filepart&#34; to the end of file names. The extra file extension tends to be added when I&#39;m downloading several PDF files at the same time. So instead of having files named &#34;MyFile.pdf&#34;, they would be changed to &#34;MyFile.pdf.filepart&#34;. At first, this seemed like something I needed to just live with. The files worked fine once the extra extension was removed, [...]]]></description>
			<content:encoded><![CDATA[<p>One thing about downloading files with WinSCP using Secure FTP (SFTP) is that sometimes it adds &quot;.filepart&quot; to the end of file names. The extra file extension tends to be added when I&#39;m downloading several PDF files at the same time. So instead of having files named &quot;MyFile.pdf&quot;, they would be changed to &quot;MyFile.pdf.filepart&quot;.<span id="more-158"></span></p>
<p><img class="size-full wp-image-159 alignright" title="WinSCP - Folder List Screenshot" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_WinSCP.gif" alt="WinSCP - Folder List Screenshot" width="339" height="127" />At first, this seemed like something I needed to just live with. The files worked fine once the extra extension was removed, so maybe it&#39;s a weird quirk of WinSCP. But it turns out that the &quot;.filepart&quot; actually means the file download was interrupted. According to the WinSCP help docs</p>
<blockquote><p>When transferring file with SFTP protocol, it is first transferred into a temporary file with .filepart extension. Only after the transfer is completed the extension is removed.</p></blockquote>
<p>So instead of removing the extra extension manually, you just need to re-initiate the download. Note that it&#39;s doesn&#39;t need to download the entire file again, WinSCP seems to remember where it left off.</p>
<h3>Related Resources</h3>
<ul>
<li><a href="http://winscp.net/eng/docs/resume">WinSCP Help Docs: Transfer Resume</a> – provides more information about the .filepart extension.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-05/what-the-filepart-extension-means-when-downloading-files-with-winscp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Turn Off Curly Quotes in WordPress so They Don&#8217;t Break Your PHP Tutorials</title>
		<link>http://www.cyberscorpion.com/2011-05/how-to-turn-off-curly-quotes-in-wordpress-so-they-dont-break-your-php-tutorials/</link>
		<comments>http://www.cyberscorpion.com/2011-05/how-to-turn-off-curly-quotes-in-wordpress-so-they-dont-break-your-php-tutorials/#comments</comments>
		<pubDate>Tue, 10 May 2011 01:19:58 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[curly quotes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress Plug-ins]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=153</guid>
		<description><![CDATA[Have you ever copied PHP code from a website tutorial, but no matter what you did you couldn&#39;t get it to work? Or maybe you&#39;re posting code on a WordPress blog and can&#39;t figure out why people are saying the code doesn&#39;t work? Well you&#39;re not alone. You may have been bitten by the curly [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever copied PHP code from a website tutorial, but no matter what you did you couldn&#39;t get it to work? Or maybe you&#39;re posting code on a WordPress blog and can&#39;t figure out why people are saying the code doesn&#39;t work? Well you&#39;re not alone. You may have been bitten by the curly quote bug in WordPress.<span id="more-153"></span></p>
<p>OK, it&#39;s not technically a bug, but its irritating none-the-less. If you haven&#39;t posted to WordPress before, it automatically changes all your single and double quotes to curly (or smart) quotes. <em>(See Figure 1)</em> The curly quotes may look nice in regular text posts, but they prevent PHP code from working properly.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-156" title="Graphic Showing Curly vs Straight Quotes" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_WordPressCurlyQuotes1.gif" alt="Graphic Showing Curly vs Straight Quotes" width="621" height="201" /></p>
<p><span>Figure 1.</span> Curly vs Straight Quotes</div>
<p><!-- pwn_figure --></p>
<p>For some reason, WordPress doesn&#39;t providing any settings to turn off curly quotes like they do for the emoticons. However, there are ways around this.</p>
<h3>Note to WordPress.com Users</h3>
<p>The following options don&#39;t seem to be available for the FREE version of WordPress.com. I&#39;m not sure about the paid version.</p>
<h3>Option 1: Custom Function</h3>
<p>If you&#39;re feeling bold, you could add a little code snippet (developed by <a href="http://www.lonewolfdesigns.co.uk/removing-smart-quotes-wordpress-posts/">Lonewolf Designs</a>) to your functions.php page which replaces curly quotes with straight ones. First we need to define a function which does the replacement:</p>
<div class="pwn_codeBlock">function removesmartquotes($content) {<br />
     $content = str_replace(&#39;&amp;#8220;&#39;, &#39;&amp;quot;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8221;&#39;, &#39;&amp;quot;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8216;&#39;, &#39;&amp;#39;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8217;&#39;, &#39;&amp;#39;&#39;, $content);<br />
    <br />
     return $content;<br />
}</div>
<p><!-- pwn_codeBlock --></p>
<p>Then you just need to declare the function with WordPress using it&#39;s add_filter() function:</p>
<div class="pwn_codeBlock">add_filter(&#39;the_content&#39;, &#39;removesmartquotes&#39;);</div>
<p><!-- pwn_codeBlock --></p>
<p>You can remove the curly quotes from other aspects of your blog by replacing the first argument of the add_filter() function with a different WordPress Template Tag. For example, to remove curly quotes from the comments section you would add the following code:</p>
<div class="pwn_codeBlock">add_filter(&#39;comment_text&#39;, &#39;removesmartquotes&#39;);</div>
<p><!-- pwn_codeBlock --></p>
<p>Once you&#39;re ready to add the code to your function.php page, the file can be found using FTP or by following these steps:</p>
<ol>
<li>Log into your WordPress admin area</li>
<li>Click the <strong>Appearance</strong> option on the left</li>
<li>Click the <strong>Editor</strong> option under Appearance</li>
<li>Under the Templates section on the right, click the &quot;Theme Functions&quot; link</li>
<li>Add the code and click the &quot;Update File&quot; button</li>
</ol>
<p><strong>Note:</strong> the code needs to be added between the open and close tags for PHP (&lt;?php ?&gt;). Otherwise the code snippet will break the layout of your <span>WordPress</span> blog.</p>
<div class="pwn_codeBlock">
&lt;?php<br />
function removesmartquotes($content) {<br />
     $content = str_replace(&#39;&amp;#8220;&#39;, &#39;&amp;quot;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8221;&#39;, &#39;&amp;quot;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8216;&#39;, &#39;&amp;#39;&#39;, $content);<br />
     $content = str_replace(&#39;&amp;#8217;&#39;, &#39;&amp;#39;&#39;, $content);<br />
    <br />
     return $content;<br />
}</p>
<p>add_filter(&#39;the_content&#39;, &#39;removesmartquotes&#39;);<br />
add_filter(&#39;comment_text&#39;, &#39;removesmartquotes&#39;);<br />
?&gt;
</p></div>
<p><!-- pwn_codeBlock --></p>
<h3><span>Option 2: <span>Plugins</span></span></h3>
<p><span>If you&#39;re looking for a more straightforward solution, there are several <span>WordPress</span> plugins available to turn off curly quotes. To install a <span>plugin</span></span></p>
<ol>
<li><span>Log into your <span>WordPress</span> admin area</span></li>
<li>Click the <strong><span><span>Plugins</span></span></strong> option on the left</li>
<li>Near the top of the page, click the <strong>Add New</strong> button</li>
<li>In the search field, type &quot;Curly Quote&quot;</li>
<li><span>Locate the <span>plugin</span> you want to use and click the </span><strong>Install Now</strong> link/button</li>
<li><span>Verify that it&#39;s <span>ok</span> to install the <span>plugin</span> and activate it</span></li>
</ol>
<p><span>For more control over which parts of the post don&#39;t have curly quotes, you might want to check out the &quot;No Curly Quotes&quot; <span>plugin</span>. Once activated, you can click the &quot;No Curly Quotes&quot; option under Settings. Then indicate whether to show curly quotes in post titles, post content, excerpt, or comments. </span><em>(See Figure 2)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-155" title="WordPress - Options for the No Curly Quotes Plugin" src="http://www.cyberscorpion.com/wp-content/uploads/2011/05/2011-05_WordPressCurlyQuotes2.gif" alt="WordPress - Options for the No Curly Quotes Plugin" width="521" height="363" /></p>
<p><span>Figure 2.</span><span>Options for the No Curly Quotes <span>Plugin</span></span></div>
<h3>Related Resources</h3>
<ul class="pwn_double">
<li><a href="http://codex.wordpress.org/Function_Reference/add_filter"><span><span>WordPress</span> Codex: add_filter()</span></a><span>– describes the add_filter() function provided by <span>WordPress</span>.</span></li>
<li><a href="http://codex.wordpress.org/Template_Tags">WordPress Codex: Template Tags</a> – provides a list of tags that could potentially be used with add_filter() to turn off curly quotes.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-05/how-to-turn-off-curly-quotes-in-wordpress-so-they-dont-break-your-php-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Older Stats for Your Libsyn.com Hosted Podcast</title>
		<link>http://www.cyberscorpion.com/2011-05/getting-older-stats-for-your-libsyn-com-hosted-podcast/</link>
		<comments>http://www.cyberscorpion.com/2011-05/getting-older-stats-for-your-libsyn-com-hosted-podcast/#comments</comments>
		<pubDate>Tue, 03 May 2011 01:52:05 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[Libsyn]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=147</guid>
		<description><![CDATA[Gathering first quarter statistics for our Libsyn.com hosted podcast was a little more complicated than expected. The admin panel provided everything that was needed except the number of downloads per episode for January 2011. After trying quite a few things, it turns out the data is available but I needed to work for it. For those hosting through Libsyn.com, you can find out some basic information about your podcast by [...]]]></description>
			<content:encoded><![CDATA[<p>Gathering first quarter statistics for our Libsyn.com hosted podcast was a little more complicated than expected. The admin panel provided everything that was needed except the number of downloads per episode for January 2011. After trying quite a few things, it turns out the data is available but I needed to work for it.<span id="more-147"></span></p>
<p>For those hosting through Libsyn.com, you can find out some basic information about your podcast by logging into the Libsyn3 admin panel and clicking the Statistics option near the top. <em>(See Figure 1)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-149" title="Libsyn - Statistics Icon" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-05_GettingOlderLibsynStats1.gif" alt="Libsyn - Statistics Icon" width="389" height="151" /><br />
<span>Figure 1.</span> Statistics Option</div>
<p>Scrolling past the graph, you&#39;ll see a breakdown of the podcast episodes and the number of times each was listened to in the most recent three months. So April, March, and February for example. If you need data from the earlier months, click the magnifying glass icon next to the episode title. <em>(See Figure 2)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-150" title="Libsyn - Magnifying Glass Icon" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-05_GettingOlderLibsynStats2.gif" alt="Libsyn - Magnifying Glass Icon" width="208" height="121" /><br />
<span>Figure 2.</span> Magnifying Glass Icon<!-- pwn_figure --></div>
<p>You should now see the statistics for the selected podcast episode. From this point, the data shown can be adjusted using the &quot;Custom period&quot; fields below the graph. <em>(See Figure 3)</em> So to get information for January, change the start date to &quot;2011-01-01&quot; and end date to &quot;2011-01-31&quot;.</p>
<p><strong>Note:</strong> you can&#39;t use dates where there is no data. For example, if the episode was released on Dec. 1, 2010; you won&#39;t be able to type &quot;2010-11-01&quot;.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-151" title="Libsyn - Fields to Modify the Stats Shown" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-05_GettingOlderLibsynStats3.gif" alt="Libsyn - Fields toModify the Stats Shown" width="401" height="214" /><br />
<span>Figure 3.</span> Custom Period Fields to Adjust the Stats Shown<!-- pwn_figure --></div>
<p>When you have everything needed for the selected podcast episode, click the close button near the top of the page. <em>(See Figure 4)</em></p>
<p><strong>Note:</strong> if you need information for multiple time frames, you could download the entire dataset for the selected episode by clicking the &quot;Export&quot; button below the graph.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-152" title="Libsyn - Close Button" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-05_GettingOlderLibsynStats4.gif" alt="Libsyn - Close Button" width="284" height="170" /><br />
<span>Figure 4.</span> Close Button</div>
<p><!-- pwn_figure --></p>
<p>As you would guess, getting stats this way could be very time consuming. Especially if you have a lot of episodes, but at least there is an option for retrieving older data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-05/getting-older-stats-for-your-libsyn-com-hosted-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Searching Source Code vs Text in Adobe Dreamweaver</title>
		<link>http://www.cyberscorpion.com/2011-04/more-adobe-dreamweaver-search-issues-source-code-vs-text/</link>
		<comments>http://www.cyberscorpion.com/2011-04/more-adobe-dreamweaver-search-issues-source-code-vs-text/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 01:17:26 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=142</guid>
		<description><![CDATA[Have you ever searched for something using Dreamweaver that you know exists but nothing comes up? You may even try something so blatantly obvious like the &#60;p&#62; tag and it still doesn&#39;t find any matches! For the longest time I&#39;ve ignored this type of issue since it didn&#39;t happen very often, but it&#39;s been in the back of my mind. Well I finally broke down and figured out the cause [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever searched for something using Dreamweaver that you know exists but nothing comes up? You may even try something so blatantly obvious like the &lt;p&gt; tag and it still doesn&#39;t find any matches! For the longest time I&#39;ve ignored this type of issue since it didn&#39;t happen very often, but it&#39;s been in the back of my mind. Well I finally broke down and figured out the cause of the issue; it all comes down to searching the <strong>Source Code</strong> vs <strong>Text</strong>.<span id="more-142"></span></p>
<p>For me the issue crops up when I don&#39;t have any documents open in Dreamweaver and I hit <em>Ctrl + F</em> (the keyboard shortcut for Find and Replace). Upon looking closer at the dialog box <em>(See Figure 1)</em>, it turns out the Search field is being set to <strong>Text</strong>.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-144" title="Dreamweaver - Search Set to Text" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DWSearchCodeVsText1.gif" alt="Dreamweaver - Search Set to Text" width="640" height="268" /><br />
<span>Figure 1.</span> Search Set to Text</div>
<p><!-- pwn_figure --></p>
<p>On the other hand, if a document is open in Dreamweaver and I hit <em>Ctrl + F</em> the Search field is set to <strong>Source Code</strong> as shown in Figure 2.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-145" title="Dreamweaver - Search Set to Source Code" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DWSearchCodeVsText2.gif" alt="Dreamweaver - Search Set to Source Code" width="640" height="268" /><br />
<span>Figure 2.</span> Search Set to Source Code</div>
<p><!-- pwn_figure --></p>
<h3>Source Code vs Text</h3>
<p>So then, why didn&#39;t the search work? If the Search field is set to Text, it doesn&#39;t search everything; things like HTML tags, attributes, comments, etc. are ignored. As the name suggests, Text only searches the text that&#39;s displayed on the screen&#8230;for the most part. Even though PHP and JavaScript code can be used to display text on the screen, that content is ignored when searching with Text. So if you need to expand the search, switch to Source Code.</p>
<h3>Related Resources</h3>
<ul>
<li><a rel="prev" href="http://www.cyberscorpion.com/2011-04/adobe-dreamweaver-bug-causes-the-find-in-folder-feature-to-select-the-wrong-folder/">Adobe Dreamweaver Bug Causes the Find in Folder Feature to Select the Wrong Folder</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-04/more-adobe-dreamweaver-search-issues-source-code-vs-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe Dreamweaver Bug Causes the Find in Folder Feature to Select the Wrong Folder</title>
		<link>http://www.cyberscorpion.com/2011-04/adobe-dreamweaver-bug-causes-the-find-in-folder-feature-to-select-the-wrong-folder/</link>
		<comments>http://www.cyberscorpion.com/2011-04/adobe-dreamweaver-bug-causes-the-find-in-folder-feature-to-select-the-wrong-folder/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 21:32:57 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Dreamweaver]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=136</guid>
		<description><![CDATA[For some reason I&#39;ve been having problems with the Dreamweaver&#39;s Find in Folder feature. When browsing for a folder, Dreamweaver often selects the wrong one. I don&#39;t know if the issue is with my computer, Dreamweaver, or a combination of both. But I wanted to take a few minutes to talk about how I get around the bug in case [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason I&#39;ve been having problems with the Dreamweaver&#39;s Find in Folder feature. When browsing for a folder, Dreamweaver often selects the wrong one. I don&#39;t know if the issue is with my computer, Dreamweaver, or a combination of both. But I wanted to take a few minutes to talk about how I get around the bug in case you&#39;re having the same issues. For reference I&#39;m currently using Dreamweaver CS4 on Windows Vista.<span id="more-136"></span></p>
<p>For the sake of the example, the folder structure for my imaginary website is as follows:</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-137" title="Example Folder Structure" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DreamweaverSearch1.gif" alt="Example Folder Structure" width="187" height="123" /><br />
<span>Figure 1.</span> Example Folder Structure</div>
<p>Now to search for something in all the files under the &quot;about&quot; folder I would</p>
<ul>
<li>Open the <strong>Find and Replace</strong> dialog box</li>
<li>Enter what I&#39;m looking for in the <strong>Find</strong> field</li>
<li>Under <strong>Find in</strong>, select the &quot;Folder..&quot; option</li>
<li>Click the folder icon to the right of the Find in field</li>
<li>In the <strong>Choose Search Folder</strong> window, locate and select the &quot;about&quot; folder <em>(See Figure 2)</em></li>
<li>Click Select</li>
</ul>
<p>Normally I would click the &quot;Find All&quot; button but as shown in Figure 3, Dreamweaver didn&#39;t select the correct folder.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-138" title="Dreamweaver - Selecting the Folder" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DreamweaverSearch2.gif" alt="Dreamweaver - Selecting the Folder" width="561" height="411" /><br />
<span>Figure 2.</span> Selecting the About Folder</div>
<p><!-- pwn_figure --></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-139" title="Dreamweaver - Incorrect Folder Selection" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DreamweaverSearch3.gif" alt="Dreamweaver - Incorrect Folder Selection" width="640" height="386" /><br />
<span>Figure 3.</span> Incorrect Folder Selection</div>
<p><!-- pwn_figure --></p>
<p>Well I could just type the proper folder name afterwards, but there&#39;s a quicker way which is less prone to errors. When selecting a folder, watch the &quot;Select&quot; reference in the Choose Search Folder window. <em>(See Figure 4)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-140" title="Dreamweaver - Select Indicator Showing Incorrect Folder" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DreamweaverSearch4.gif" alt="Dreamweaver - Select Indicator Showing Incorrect Folder" width="561" height="411" /><br />
<span>Figure 4.</span> Select Indicator Showing Incorrect Folder</div>
<p><!-- pwn_figure --></p>
<p>This shows the folder that Dreamweaver will select. So if the one needed isn&#39;t mentioned, just click one directory deeper into the folder structure if you can. Dreamweaver still selects the parent directory, but now I&#39;m getting the &quot;about&quot; folder. <em>(See Figure 5)</em></p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-141" title="Dreamweaver – Select Indicator Showing Correct Folder" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_DreamweaverSearch5.gif" alt="Dreamweaver – Select Indicator Showing Correct Folder" width="571" height="421" /><br />
<span>Figure 5.</span> Select Indicator Showing Correct Folder</div>
<p><!-- pwn_figure --></p>
<p>The weird thing about this bug is that it seems very inconsistent. Sometimes the parent directory is selected, other times Dreamweaver selects the folder I want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-04/adobe-dreamweaver-bug-causes-the-find-in-folder-feature-to-select-the-wrong-folder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Setting up a Makeshift Test Environment for Experimenting with PHP Code</title>
		<link>http://www.cyberscorpion.com/2011-04/setting-up-a-makeshift-test-environment-for-experimenting-with-php-code/</link>
		<comments>http://www.cyberscorpion.com/2011-04/setting-up-a-makeshift-test-environment-for-experimenting-with-php-code/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 01:35:06 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=133</guid>
		<description><![CDATA[There are times I need to experiment with new code or re-familiarizing myself with code already in use. But sometimes when I&#39;m testing code in an existing project, the other project code (sending out e-mails, updating databases, etc.) can get in the way. I usually comment out the code to prevent it from executing, but that can be more work than it&#39;s worth. Plus I may forget to uncomment something when [...]]]></description>
			<content:encoded><![CDATA[<p>There are times I need to experiment with new code or re-familiarizing myself with code already in use. But sometimes when I&#39;m testing code in an existing project, the other project code (sending out e-mails, updating databases, etc.) can get in the way. I usually comment out the code to prevent it from executing, but that can be more work than it&#39;s worth. Plus I may forget to uncomment something when the tests are over. So instead it can be easier to start a new file and focus on the code at hand.<span id="more-133"></span></p>
<h3>Example Problem</h3>
<p>I&#39;ve developed several management tools where customers can submit information and make modifications to their submissions throughout the year. In some of the forms a reference ID is passed to indicate which database record they are trying to update. When the form is submitted, several checks are done on the back-end to make sure the request is valid. One of those checkpoints is to make sure the reference ID only contains numbers.</p>
<p>The code in place for validating the ID works fine, but I&#39;ve been looking for a more efficient way. Well recently I heard about a PHP function called ctype_digit() which checks if a string only contains numbers. Although the function looks promising, I wanted to run some tests before making the switch. And due to the complicated nature of the forms, I started a new page before running the tests.</p>
<h3>Testing the Code</h3>
<p>There are multiple ways to set up your testing environment, but some are more efficient than others depending on how many scenerios you plan to run through. For example, you could create a variable which holds the test value, run the test, and display the results.</p>
<div class="pwn_codeBlock">&lt;?php<br />
$value_to_test = &#39;8000&#39;;<br />
if(ctype_digit($value_to_test)) {<br />
     echo &quot;$value_to_test is a number&quot;;<br />
} else {<br />
     echo &quot;$value_to_test contains characters other than numbers&quot;;<br />
}<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>But this solution gets a little cumbersome with multiple values. Every test requires that you modify the $value_to_test variable and re-upload the script.</p>
<p>When there are many values to test, I prefer to pass the test value through the URL (http://www.MyWebsite.com/testcode.php?value=8000 for example). Then I just need to use $_GET to retrieve the value.</p>
<div class="pwn_codeBlock">&lt;?php<br />
$value_to_test = $_GET['value'];<br />
if(ctype_digit($value_to_test)) {<br />
     echo &quot;$value_to_test is a number&quot;;<br />
} else {<br />
     echo &quot;$value_to_test contains characters other than numbers&quot;;<br />
}<br />
?&gt;</div>
<p><!-- pwn_codeBlock --></p>
<p>Now I can test until my heart is content without needing to re-upload the code.</p>
<h3>Related Resources</h3>
<ul>
<li><a href="http://php.net/manual/en/function.ctype-digit.php">PHP Manual: ctype_digit()</a> – describes the ctype_digit() function in more detail.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-04/setting-up-a-makeshift-test-environment-for-experimenting-with-php-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Overcome the Skepticism of Announcing Products on April Fools Day</title>
		<link>http://www.cyberscorpion.com/2011-04/how-to-overcome-the-skepticism-of-announcing-products-on-april-fools-day/</link>
		<comments>http://www.cyberscorpion.com/2011-04/how-to-overcome-the-skepticism-of-announcing-products-on-april-fools-day/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 01:05:14 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Communication Skills]]></category>
		<category><![CDATA[April Fools Day]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=128</guid>
		<description><![CDATA[Every year on this day, organizations announce new products, developments, events, etc. But by and large the announcements tend to be ignored because they coincide with April Fools Day. So I wanted to take this opportunity to offer some tips &#38; tricks for letting you&#39;re audience know that you&#39;re serious. It may be too late to utilize the techniques this year, but [...]]]></description>
			<content:encoded><![CDATA[<p>Every year on this day, organizations announce new products, developments, events, etc. But by and large the announcements tend to be ignored because they coincide with April Fools Day. So I wanted to take this opportunity to offer some tips &amp; tricks for letting you&#39;re audience know that you&#39;re serious. It may be too late to utilize the techniques this year, but as you know there&#39;s always next year.<span id="more-128"></span><br />
<img class="alignnone size-full wp-image-130" title="April Fools Day Tip 1" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_AprilFoolsDay1.gif" alt="April Fools Day Tip 1" width="280" height="200" /></p>
<p>Here are few of my favorite April Fools jokes for 2011.</p>
<h3>Diablo III &#8211; Horadric Cube</h3>
<p>Blizzard Entertainment announced that they are releasing an app that allows you to combine your &quot;existing apps into a new, potentially more powerful app.&quot; More information about the app can be found on Blizzard&#39;s website (<a href="http://us.blizzard.com/diablo3/media/horadrapp/">http://us.blizzard.com/diablo3/media/horadrapp/</a>). They even provided a quick sample showing the Transmute functionality. I love that they referenced the Secret Cow Level; check out the screenshot below.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-131" title="Horadric Cube app" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_AprilFoolsDay2.jpg" alt="Horadric Cube app" width="434" height="420" /></div>
<h3>Google &#8211; Gmail Motion</h3>
<p>Google introduced the future of Gmail. Why use the outdated mouse and keyboard when a few simple gestures will do the trick. I can&#39;t wait to send messages in Gmail Motion; &quot;lick a stamp and place it down.&quot; More information, including a handy motion guide can be found online (<a href="http://mail.google.com/mail/help/motion.html">http://mail.google.com/mail/help/motion.html</a>).</p>
<div><iframe title="YouTube video player" width="560" height="349" src="http://www.youtube.com/embed/Bu927_ul_X0" frameborder="0" allowfullscreen></iframe></div>
<h3>Tricky Website Prank</h3>
<p>Earlier in the day, I was looking for some JavaScript information and came across a website playing a cruel prank. It took a little while to figure out that <a href="http://www.howtocreate.co.uk/">http://www.howtocreate.co.uk/</a> modified how the mouse works with their website. If you moved the mouse to the right, it would go left. And moving the mouse up would cause the cursor to move down. They even changed the mouse pointer so that it was upside down as shown in the screenshot below. At least they let you in on the prank after a few seconds by telling you to click the <em>Esc</em> key.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-132" title="How to Create Website Screenshot" src="http://www.cyberscorpion.com/wp-content/uploads/2011/04/2011-04_AprilFoolsDay3.gif" alt="How to Create Website Screenshot" width="486" height="225" /></div>
<div id="_mcePaste" class="mcePaste" style="position: absolute; width: 1px; height: 1px; overflow: hidden; top: 0px; left: -10000px;">﻿</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-04/how-to-overcome-the-skepticism-of-announcing-products-on-april-fools-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking Multiple Browsers Before Responding to Website Support Requests</title>
		<link>http://www.cyberscorpion.com/2011-03/checking-multiple-browsers-before-responding-to-website-support-requests/</link>
		<comments>http://www.cyberscorpion.com/2011-03/checking-multiple-browsers-before-responding-to-website-support-requests/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 01:28:25 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Communication Skills]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browser testing]]></category>
		<category><![CDATA[usability testing]]></category>
		<category><![CDATA[website support]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=124</guid>
		<description><![CDATA[When responding to support requests involving a website it&#39;s important to remember that the customer may not be using the same browser as you. They may not even use the same operating system (Windows, Macintosh, etc.) There are many issues that I&#39;ve seen over the years as a website developer which work perfectly fine in one browser [...]]]></description>
			<content:encoded><![CDATA[<p>When responding to support requests involving a website it&#39;s important to remember that the customer may not be using the same browser as you. They may not even use the same operating system (Windows, Macintosh, etc.) There are many issues that I&#39;ve seen over the years as a website developer which work perfectly fine in one browser and completely fall apart in another. So make sure that you have covered your bases before responding to the customer.<span id="more-124"></span></p>
<p><img class="alignright size-full wp-image-125" title="Simplified Website Support Example" src="http://www.cyberscorpion.com/wp-content/uploads/2011/03/2011-03_TestingMultipleBrowsers.jpg" alt="Simplified Website Support Example" width="250" height="215" />For example, I recently contacted a service provider about an issue with using their admin panel to print invoices. For some reason the white background wouldn&#39;t print with the invoice. Since the invoice was layered over top of some other text everything would mush together making it difficult to read. Their almost instant response was that the invoices print fine for them. Then they proceeded to ask for more information.</p>
<p>Well this caused a light bulb to go off in my head and what do you know; the invoices print fine in Firefox. But what about the average customer who may be less familiar with technology? It would have been nice if the service provider looked into the issue on the other common browsers, especially since the form where you submit a support ticket automatically collected my browser information.</p>
<p>If given a choice, I prefer to limit the amount of back and forth between the customer trying to solve an issue. They have better things to do than to help me troubleshoot. ﻿﻿For more information about my internal thought process for helping customer, check out my previous post titled “<a href="http://www.cyberscorpion.com/2010-10/8/">Tips for Handling Website Support Requests</a>.”</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-03/checking-multiple-browsers-before-responding-to-website-support-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress, Why Do You Mock Me?</title>
		<link>http://www.cyberscorpion.com/2011-03/wordpress-why-do-you-mock-me/</link>
		<comments>http://www.cyberscorpion.com/2011-03/wordpress-why-do-you-mock-me/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 02:19:54 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=119</guid>
		<description><![CDATA[When installing WordPress there is one thing that always bothers me. If you look at your blog page after the installation process the tagline is set to &#34;Just another WordPress site.&#34; I would imagine the WordPress developers didn&#39;t mean anything by it, but the message isn&#39;t very welcoming. Ok, I know there are a lot of blogs out [...]]]></description>
			<content:encoded><![CDATA[<p>When installing WordPress there is one thing that always bothers me. If you look at your blog page after the installation process the tagline is set to &quot;Just another WordPress site.&quot; I would imagine the WordPress developers didn&#39;t mean anything by it, but the message isn&#39;t very welcoming.<span id="more-119"></span></p>
<div class="pwn_figure"><img class="size-full wp-image-122 alignnone" title="Default WordPress Tagline" src="http://www.cyberscorpion.com/wp-content/uploads/2011/03/2011-03_WordPressMocking.jpg" alt="Default WordPress Tagline" width="366" height="236" /></div>
<p>Ok, I know there are a lot of blogs out there and I&#39;m sure there are people out there who sarcastically say &quot;O&#39; boy another blog!&quot; But not you WordPress. Maybe the tagline should be &quot;Another awesome WordPress site in the works!&quot; They don&#39;t have to mean it.</p>
<h3>Removing the &quot;Just another WordPress site&quot;</h3>
<p>To change the tagline or remove it completely</p>
<ol>
<li>Log into your WordPress admin panel</li>
<li>Click the <strong>Settings</strong> option in the left menu <em>(See Figure 1)</em></li>
<li>Under General Setting, change or remove the text found in the <strong>Tagline</strong> field</li>
<li>Click the <strong>Save Changes</strong> button</li>
</ol>
<div class="pwn_figure"><img class="alignnone size-full wp-image-111" title="WordPress Settings Option" src="http://www.cyberscorpion.com/wp-content/uploads/2011/03/2011-03_WordPressTimezone1.gif" alt="WordPress Settings Option" width="168" height="150" /><br />
<span>Figure 1.</span> WordPress Settings Option</div>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-03/wordpress-why-do-you-mock-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding Keywords Quickly on Web Pages with Ctrl + F</title>
		<link>http://www.cyberscorpion.com/2011-03/finding-keywords-quickly-on-web-pages-with-ctrl-f/</link>
		<comments>http://www.cyberscorpion.com/2011-03/finding-keywords-quickly-on-web-pages-with-ctrl-f/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 02:22:50 +0000</pubDate>
		<dc:creator>Patrick Nichols</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[keyboard shortcuts]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://www.cyberscorpion.com/?p=114</guid>
		<description><![CDATA[When visiting websites, there&#39;s a good chance that you&#39;re looking for something specific. You may come across pages that look promising, but after an initial scan you might not see the keywords you&#39;re looking for. Instead of going somewhere else or attempting to look closer at the page, why don&#39;t you give Ctrl + F a whirl. Lets say that there&#39;s a major buzz going around the office [...]]]></description>
			<content:encoded><![CDATA[<p>When visiting websites, there&#39;s a good chance that you&#39;re looking for something specific. You may come across pages that look promising, but after an initial scan you might not see the keywords you&#39;re looking for. Instead of going somewhere else or attempting to look closer at the page, why don&#39;t you give <em>Ctrl + F</em> a whirl.<span id="more-114"></span></p>
<p>Lets say that there&#39;s a major buzz going around the office about a Whoopie Pie article found on the USA Today website. After some intense conversations you decided to check out the full article. Once you&#39;re on the page, you can quickly find the article by hitting <em>Ctrl + F</em> and typing &quot;Whoopie Pie&quot; into the search field. As shown in Figure 1, the browser will highlight the specific text if it was found on the page.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-116" title="USA Today Screenshot" src="http://www.cyberscorpion.com/wp-content/uploads/2011/03/2011-03_BrowserShortcuts1.gif" alt="USA Today Screenshot" width="625" height="284" /><br />
<span>Figure 1.</span> USA Today Screenshot</div>
<p>In the previous example, there was only one match for &quot;Whoopie Pie&quot;. So what happens when there are more? To see, let&#39;s visit the website for the PHP manual (<a href="http://www.php.net">www.php.net</a>). If you hit <em>Ctrl + F</em> and type &quot;PHP&quot; into the search field, you&#39;ll see that the mentions of PHP will be highlighted as shown in Figure 2. Note that you can use the &quot;Previous&quot; and &quot;Next&quot; buttons near the search field to jump through the various references.</p>
<div class="pwn_figure"><img class="alignnone size-full wp-image-117" title="Screenshot of the PHP Manual Website" src="http://www.cyberscorpion.com/wp-content/uploads/2011/03/2011-03_BrowserShortcuts2.gif" alt="Screenshot of the PHP Manual Website" width="650" height="412" /><br />
<span>Figure 2.</span> PHP Manual Screenshot</div>
<p>As you can see <em>Ctrl + F </em>is a very handy option for finding text quickly. Of course it requires that your search text to be exact. In other words if we typed &quot;Whoopie pies are delicious&quot; in the USA Today example, there wouldn&#39;t have been any matches. Also, note that <em>Ctrl + F </em>is available in other software applications such as Microsoft Word and Adobe Dreamweaver.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberscorpion.com/2011-03/finding-keywords-quickly-on-web-pages-with-ctrl-f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

