<?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>Allan Collins &#187; PHP</title> <atom:link href="http://www.allancollins.net/category/php/feed/" rel="self" type="application/rss+xml" /><link>http://www.allancollins.net</link> <description>Official home of a Colorado Web Developer.</description> <lastBuildDate>Tue, 10 Aug 2010 15:59:20 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=abc</generator> <item><title>An Introduction to PHP</title><link>http://www.allancollins.net/407/an-introduction-to-php/</link> <comments>http://www.allancollins.net/407/an-introduction-to-php/#comments</comments> <pubDate>Sat, 20 Feb 2010 21:48:16 +0000</pubDate> <dc:creator>Allan Collins</dc:creator> <category><![CDATA[PHP]]></category><guid isPermaLink="false">http://www.allancollins.net/?p=407</guid> <description><![CDATA[Learning PHP is a big step for anyone to take.  With PHP, you can extend WordPress by writing your own plugins or perhaps you want to write a web application that solves a problem.]]></description> <content:encoded><![CDATA[ <script type="text/javascript" src="http://www.allancollins.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script> <p>Learning PHP is a big step for anyone to take.  With PHP, you can extend WordPress by writing your own plugins or perhaps you want to write a web application that solves a problem.</p><h2>Hello World!</h2><p>Just about every programming book starts with the &#8220;Hello World!&#8221; application. The following will display &#8220;Hello World!&#8221; in the browser:  echo &#8220;Hello World!&#8221;;</p><p>There you have it.  Your very first PHP application.</p><p>For more information on how you can learn PHP in 17 hours <a href="http://bfc777pkmar93s6nqh4imbpj5o.hop.clickbank.net/">click here</a>.<pre class="brush: php">&lt;?php
echo &quot;Hello World!&quot;;
?&gt;</pre></p> ]]></content:encoded> <wfw:commentRss>http://www.allancollins.net/407/an-introduction-to-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Form Helper Class</title><link>http://www.allancollins.net/349/form-helper-class/</link> <comments>http://www.allancollins.net/349/form-helper-class/#comments</comments> <pubDate>Fri, 19 Jun 2009 00:37:53 +0000</pubDate> <dc:creator>Allan Collins</dc:creator> <category><![CDATA[PHP]]></category><guid isPermaLink="false">http://www.allancollins.net/?p=349</guid> <description><![CDATA[Make your life a little bit easier with the help of an HTML form helper class.]]></description> <content:encoded><![CDATA[ <script type="text/javascript" src="http://www.allancollins.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script> <div class="download-link"><a href="http://www.allancollins.net/wp-content/uploads/2009/06/formHelper.txt"><b>Download The Form Helper Class</b></a> <br/> Version 0.1</div><p>Tired of writing repetitive HTML for forms?<br /> Create forms faster and maintain them easier with a form helper class.</p><p><br/></p><div class="featurebox"><h2>Text Input</h2><p>$object-&gt;input($label,$name,$value,$params);</p><p><strong>Example:</strong> $form-&gt;input(&#8216;First Name:&#8217;,'first_name&#8217;,'Joe&#8217;,array(&#8216;size&#8217;=&gt;&#8217;10&#8242;));</p><p>This will create the following:</p><p><em>&lt;label for=&#8221;first_name&#8221;&gt;First Name:&lt;/label&gt; &lt;input type=&#8221;text&#8221; name=&#8221;first_name&#8221; value=&#8221;Joe&#8221; size=&#8221;10&#8243; /&gt;</em></p><p>The $params array can be any parameter you want it to be.  You can put classes, styles, etc.<br /> $value and $params are optional.</p></div><div class="featurebox"><h2>TextArea</h2><p>$object-&gt;textarea($label,$name,$value,$params);</p><p><strong>Example:</strong> $form-&gt;textarea(&#8216;Comment:&#8217;,'comment&#8217;,'This is my comment.&#8217;,array(&#8216;rows&#8217;=&gt;&#8217;10&#8242;));</p><p>This will create the following:</p><p><em>&lt;label for=&#8221;comment&#8221;&gt;Comment:&lt;/label&gt;&lt;textarea name=&#8221;comment&#8221; rows=&#8221;10&#8243;&gt;This is my comment.&lt;/textarea&gt;<br /> </em></p><p>The $params array can be any parameter you want it to be.  You can put classes, styles, etc.<br /> $value and $params are optional.</p></div><div class="featurebox"><h2>Select Dropdown</h2><p>$object-&gt;select($label,$name,$value,$params);</p><p><strong>Example:</strong> $form-&gt;select(&#8216;How many kids do you have?&#8217;,'number_of_kids&#8217;,array(0,1,2,3,4));</p><p>This will create the following:</p><p><em>&lt;label for=&#8221;number_of_kids&#8221;&gt;How many kids do you have?&lt;/label&gt;&lt;select name=&#8221;number_of_kids&#8221;&gt;</em></p><p><em>&lt;option value=&#8221;0&#8243;&gt;0&lt;/option&gt;</em></p><p><em>&lt;option value=&#8221;1&#8243;&gt;1&lt;/option&gt;</em></p><p><em>&lt;option value=&#8221;2&#8243;&gt;2&lt;/option&gt;</em></p><p><em>&lt;option value=&#8221;3&#8243;&gt;3&lt;/option&gt;</em></p><p><em>&lt;option value=&#8221;4&#8243;&gt;4&lt;/option&gt;</em></p><p><em>&lt;/select&gt;<br /> </em></p><p>The $params array can be any parameter you want it to be.  You can put classes, styles, etc.<br /> $params are optional.</p></div><p>This class doesn&#8217;t have the option to create checkboxes or radio buttons, but that is definitely on the way in a future update.  I hope this class helps you as much as it helps me out.</p><p><pre class="brush: php">include &quot;formHelper.php&quot;; // Include the class file.

$form=new formBuilder();  // Initialize the helper.

echo $form-&gt;open('formProcessor.php','post'); // Open the form tag, list where it goes and how it is supposed to get there.

echo $form-&gt;input('First Name:','first_name'); // Create an text input field.

echo $form-&gt;select('How many kids do you have?','number_of_kids',array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)); // Create a select dropdown.

echo $form-&gt;textarea('Comments','comments','',array('rows'=&gt;'10')); // Create a textarea.

echo $form-&gt;submit('Submit It Now!'); //Create a submit button.

echo &quot;&lt;/form&gt;&quot;; // Close the form tag.</pre></p> ]]></content:encoded> <wfw:commentRss>http://www.allancollins.net/349/form-helper-class/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Alternative to WordPress is_home()</title><link>http://www.allancollins.net/272/alternative-to-wordpress-is_home/</link> <comments>http://www.allancollins.net/272/alternative-to-wordpress-is_home/#comments</comments> <pubDate>Thu, 05 Mar 2009 14:00:31 +0000</pubDate> <dc:creator>Allan Collins</dc:creator> <category><![CDATA[PHP]]></category><guid isPermaLink="false">http://www.allancollins.net/?p=272</guid> <description><![CDATA[Need a better way to check if the current page is the homepage?]]></description> <content:encoded><![CDATA[ <script type="text/javascript" src="http://www.allancollins.net/wp-content/plugins/wordpress-code-snippet/scripts/shBrushPhp.js"></script> <p>Do you have a static page set for your homepage and a blog posts section set as well?  I bet you&#8217;ve tried the built in WordPress function is_home() that will return true for both the homepage and the blog section and have gotten frustrated.</p><p>Have no fear!  I have created a function that I use on a continuous basis to check if the current page is the homepage.</p><p>Add this to your functions.php file in your theme folder:<pre class="brush: php">function is_it_home($post_id=0) {
	global $post;
	$post_id=$post-&gt;ID;
	$frontpage=get_option('page_on_front');
	
	if ($post_id == $frontpage) {
		return true;
	}else{
		return false;
	}
	
}</pre></p> ]]></content:encoded> <wfw:commentRss>http://www.allancollins.net/272/alternative-to-wordpress-is_home/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 17/34 queries in 0.018 seconds using disk

Served from: www.allancollins.net @ 2010-09-06 13:36:14 -->