<?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>PHP Scripts and Programming&#187; PHP Programming</title>
	<atom:link href="http://www.warkensoft.com/category/php-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.warkensoft.com</link>
	<description>PHP scripts, programs and downloads for use by webmasters around the world.</description>
	<lastBuildDate>Thu, 22 Apr 2010 16:14:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wicked Cool PHP &#8211; Review</title>
		<link>http://www.warkensoft.com/2009/11/wicked-cool-php-review/</link>
		<comments>http://www.warkensoft.com/2009/11/wicked-cool-php-review/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 08:59:16 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Webmaster Resources]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[learn php]]></category>
		<category><![CDATA[php books]]></category>
		<category><![CDATA[sample php scripts]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=248</guid>
		<description><![CDATA[It&#8217;s not often that I write reviews about specific products, but I recently bought this book and couldn&#8217;t resist recommending it to anyone who has a basic grasp of PHP and is looking for some practical applications and scripts to work on.  I have found it to be a great PHP scripting resource which [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_250" class="wp-caption alignleft" style="width: 131px"><a href="http://www.amazon.com/gp/product/1593271735?ie=UTF8&amp;tag=wicked-cool-php-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593271735"><img class="size-full wp-image-250 " title="Wicked Cool PHP" src="http://www.warkensoft.com/wp-content/uploads/2009/11/512ppzO2mGL._SL160_.jpg" alt="Wicked Cool PHP" width="121" height="160" /></a><p class="wp-caption-text">Wicked Cool PHP</p></div>
<p>It&#8217;s not often that I write reviews about specific products, but I recently bought this book and couldn&#8217;t resist recommending it to anyone who has a basic grasp of PHP and is looking for some practical applications and scripts to work on.  I have found it to be a great PHP scripting resource which walks through a number of very useful scripts in detail, discussing exactly what is going on and how the script might be used in real life.</p>
<p>The authors, William Steinmetz and Brian Ward, do an excellent job of walking through each script showing how it works, what the potential pitfalls are and how it might be used in real life.  The best part is, there isn&#8217;t a single &#8220;Hello World&#8221; script in the book.  Rather the scripts are solutions to real life programming situations that most PHP programmers will run in to at one point or another.</p>
<p>I highly recommend <a title="Wicked Cool PHP on Amazon.com" href="http://www.amazon.com/gp/product/1593271735?ie=UTF8&amp;tag=wicked-cool-php-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1593271735"><strong>Wicked Cool PHP</strong></a> to anyone starting out with PHP who wants to go a little deeper than &#8220;Hello World&#8221; or wants to see real examples of practical PHP scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2009/11/wicked-cool-php-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Object Unit Testing</title>
		<link>http://www.warkensoft.com/2009/06/php-object-unit-testing/</link>
		<comments>http://www.warkensoft.com/2009/06/php-object-unit-testing/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 16:15:22 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Webmaster Tools]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=228</guid>
		<description><![CDATA[I recently found a PHP tool that might actually be useful to a lot of developers in helping to keep their PHP code clean and help with bug tracking and diagnosis.  With PHP 5, we now have the ability to delve quite heavily into OOP based scripting.  This basically means creating PHP code as Objects [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found a PHP tool that might actually be useful to a lot of developers in helping to keep their PHP code clean and help with bug tracking and diagnosis.  With PHP 5, we now have the ability to delve quite heavily into OOP based scripting.  This basically means creating PHP code as Objects instead of spaghetti code.  The tool I found recently is a simple framework for testing your newly created PHP objects.  It is called <a href="http://www.lastcraft.com/overview.php">SimpleTest</a>.</p>
<p>Basically, you can build your PHP objects and use this tool to create test cases in order to ensure that future upgrades don&#8217;t break existing code.  This is called Unit Testing.  Check it out.  I&#8217;d love to know how you like it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2009/06/php-object-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin: Related Products from Amazon.com</title>
		<link>http://www.warkensoft.com/2008/11/wordpress-plugin-related-products-from-amazoncom/</link>
		<comments>http://www.warkensoft.com/2008/11/wordpress-plugin-related-products-from-amazoncom/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 06:40:52 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Revenue Building]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=77</guid>
		<description><![CDATA[This plugin will allow you to make money on your website as an Amazon.com affiliate.  It enables you to automatically advertise products from Amazon.com which are specifically related to the topic you are writing about.
Features:

Automatically load category or tag related products from Amazon.com.
Earn rewards as an affiliate, simply by entering your affiliate tracking code.
Provide valuable [...]]]></description>
			<content:encoded><![CDATA[<p>This plugin will allow you to make money on your website as an Amazon.com affiliate.  It enables you to automatically advertise products from Amazon.com which are specifically related to the topic you are writing about.</p>
<p><strong>Features:</strong></p>
<ul>
<li><strong>Automatically</strong> load category or tag related products from Amazon.com.</li>
<li><strong>Earn rewards</strong> as an affiliate, simply by entering your affiliate tracking code.</li>
<li><strong>Provide valuable additional content</strong> to your visitors on the topics of your posts.</li>
<li><strong>Total control</strong> to tailor results for any given post.</li>
<li><strong>Excellent content caching</strong> for lightning fast response times.</li>
<li><strong>Ability to disable</strong> related products from being displayed at all on any given post.</li>
<li><strong>NOT JavaScript based</strong>, meaning it is not hidden from users with no JavaScript capability.</li>
</ul>
<p><span id="more-77"></span><br />
<strong>How it Works:</strong></p>
<p>This plugin will allow you to turn your WordPress website or blog into a money making machine while at the same time offering valuable additional related materials to your visitors.  It will <strong>automatically</strong> search for and display products from Amazon.com which are <strong>specifically related to the topics you write about</strong>.  Once you install the plugin, you simply have to decide if you want to show products related to your Categories or Tags and the plugin can do the rest.  All you have to do is continue writing about your favorite subjects and the plugin will offer related products to your visitors.</p>
<p>Even though it is capable of being fully automatic in this way, it also includes powerful controls to tailor exactly how it functions.  You can customize the keywords used for searching on any given post or even disable the plugin completely.  You can also customize the heading that is shown, the number of results shown and many other aspects of how it functions.</p>
<p><strong>Get the Plugin:</strong></p>
<p>You can find the <a title="AmazonFeed WordPress Plugin" href="http://www.warkensoft.com/products/amazonfeed-wordpress-plugin/">AmazonFeed plugin homepage here</a>.</p>
<p>Want to see it in action?  I have it running at the bottom of this article.  Notice that if you hit refresh, new content may be displayed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2008/11/wordpress-plugin-related-products-from-amazoncom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SendFeed WordPress Plugin</title>
		<link>http://www.warkensoft.com/2008/11/sendfeed-wordpress-plugin/</link>
		<comments>http://www.warkensoft.com/2008/11/sendfeed-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 00:41:23 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=66</guid>
		<description><![CDATA[I&#8217;m very excited to announce the release of SendFeed, a brand new RSS/XML Feed to Email WordPress plugin.
The SendFeed Plugin for WordPress allows you to send your latest post from your RSS feed to an external Mailing List Manager in both text and HTML formats.
It is capable of sending messages out immediately, at predefined intervals [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m very excited to announce the release of <a title="SendFeed RSS/XML to EMail WordPress Plugin" href="http://truthmedia.com/wordpress/sendfeed/">SendFeed</a>, a brand new RSS/XML Feed to Email WordPress plugin.</p>
<p>The SendFeed Plugin for WordPress allows you to send your latest post from your RSS feed to an external Mailing List Manager in both text and HTML formats.</p>
<p>It is capable of sending messages out immediately, at predefined intervals such as daily/weekly/monthly or manually.  Also, the text and HTML templates are completely customizable on a per feed basis so you can tailor the emails to suit the list or feed you are using.</p>
<p>The plugin was developed by me while working for <a title="TruthMedia Internet Group" href="http://truthmedia.com/">TruthMedia</a>.  We have just released the very first edition of the plugin on WordPress.org.</p>
<p>You can find it at: <a title="SendFeed RSS/XML to EMail WordPress Plugin" onclick="javascript:pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/sendfeed/');" href="http://wordpress.org/extend/plugins/sendfeed/" target="_blank">http://wordpress.org/extend/plugins/sendfeed/</a></p>
<p>Original Post Here: <a href="http://truthmedia.com/2008/11/19/sendfeed-v-11-released/">http://truthmedia.com/2008/11/19/sendfeed-v-11-released/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2008/11/sendfeed-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website Subversion Backup</title>
		<link>http://www.warkensoft.com/2008/04/website-subversion-backup/</link>
		<comments>http://www.warkensoft.com/2008/04/website-subversion-backup/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 00:00:45 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[PHP Scripts]]></category>
		<category><![CDATA[Webmaster Tools]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[website backups]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=61</guid>
		<description><![CDATA[As a PHP coder and web developer, I have recently discovered and fallen in love with a tool which helps to keep my source code safely backed up.  This tool is called Subversion and &#8220;it is used to maintain current and historical versions of files such as source code, web pages, and documentation.&#8221; (1) [...]]]></description>
			<content:encoded><![CDATA[<p>As a PHP coder and web developer, I have recently discovered and fallen in love with a tool which helps to keep my source code safely backed up.  This tool is called <a href="http://en.wikipedia.org/wiki/Subversion_(software)">Subversion</a> and &#8220;it is used to maintain current and historical versions of files such as source code, web pages, and documentation.&#8221; (<a href="#references">1</a>)  In simple terms, it allows you to back up your files and keeps a history of all the versions of files that you send to it.</p>
<p>This is VERY useful when doing PHP development because as you develop your application you can commit versions of the files to the Subversion (SVN) repository and it will keep track of all the changes you have made.  If necessary, you can even revert back to older versions.</p>
<p>One of the difficulties that I have run into while doing website development is how to keep the live remote website synchronized with my local working copy.  This is especially true of WordPress installations where editors may be uploading new pictures or documents to the site on a daily basis.  If you are not constantly downloading the latest copy of the website, your local copy will be out-of-date and may cause problems in your development.</p>
<p><strong>Subversion to the Rescue:</strong></p>
<p>However, I have come up with a relatively simple solution to this problem, which utilizes the controls within Subversion, to both back up the data on the LIVE website, as well as providing version control for all the site data as a whole.  For the sake of simplicity, I will be using a WordPress website as my example, but the concepts here could be applied to essentially any website.</p>
<p>One of the useful features of Subversion is the ability to run what they refer to as &#8220;hook scripts&#8221; at different points in the versioning process.  For example, an SVN repository can be configured to run a set of scripts directly after any data is &#8220;committed&#8221; to it. (sending data to the repository is called &#8220;committing&#8221; the data)  For this example, this is exactly the functionality we are going to be using.</p>
<p>Before I go any further though, let&#8217;s go over some of the requirements for setting up a website and subversion repository in this way.</p>
<p><span id="more-61"></span><strong>WARNING: The following tutorial could seriously damage/destroy your website and/or server if you don&#8217;t know what you&#8217;re doing.  We take no responsibility for any problems which may occur from following these instructions. </strong></p>
<p><strong>We HIGHLY recommend that you not employ these ideas on a LIVE webserver until you have thoroughly tested things in a development environment and fully understand how things work. Proceed at your own risk.  You have been warned!<br />
</strong></p>
<p><strong>Requirements:</strong></p>
<ol>
<li>You will need shell access to the server.</li>
<li>The subversion repository must be on the same server as the website, and you will need to be able to run subversion commands on the server.</li>
<li>The user which runs the subversion repository, must also have access to add and remove files from the live website.</li>
</ol>
<p><strong>Terminology:</strong></p>
<p>Subversion Repository (SVN): The subversion repository which will contain all the website data.  Needs to be located on the same server as the website and have access to the website&#8217;s files.</p>
<p>Local Working Copy (LWC): Term used to refer to the Working Copy of the SVN repository stored on your personal computer.</p>
<p>Remote Working Copy (RWC): You will need to be able to set up a remote working copy of the SVN repository on the same server as the website and SVN.</p>
<p><strong>Setting it Up:</strong></p>
<p>The first step in setting up a website to use SVN in this way, is to set up the SVN repository itself.  I will not go into detail on how to set up an SVN repository, but for the sake of the article, let&#8217;s assume we can create the SVN repository at the path &#8220;/svnRepository/&#8221; on the remote server.  We will create the subversion repository by typing the following on the remote server shell.</p>
<blockquote><p>svnadmin create /svnRepository</p></blockquote>
<p>The next important piece of the puzzle we need is the Remote Working Copy.  Let&#8217;s assume that we can store the RWC at the path &#8220;/remoteWorkingCopy/&#8221; on the remote server.  To do this, we will enter the following shell command:</p>
<blockquote><p>svn checkout file:///svnRepository/ /remoteWorkingCopy/</p></blockquote>
<p>Finally, we will make the assumption that you already have a website set up on the remote server, and it is located at the path &#8220;/www/&#8221;.</p>
<p>In order to set this up properly you will need to ensure that you can connect to the SVN repository.  Though I will not go into the details of how to use Subversion here in this article, you need to be able to check out a copy of the remote SVN repository to your local machine.</p>
<p><strong>Synchronizing the Website with SVN:</strong></p>
<p>The next step in this process is to synchronize the current website with the SVN repository.  To do this, we will be working on the server and will need to copy all the files from the website into the Remote Working Copy.  To do this you would enter the following commands on the remote shell:</p>
<blockquote><p>cp -r /www/* /remoteWorkingCopy/</p>
<p>cp -r /www/.ht* /remoteWorkingCopy/</p></blockquote>
<p>These two commands should copy all files from the website over to the RWC.  Now, unfortunately, the RWC doesn&#8217;t yet know what to do with these files, so we have to instruct it that all the files should be added to the SVN repository.  We would do this with the following command:</p>
<blockquote><p>svn stat /remoteWorkingCopy/ | grep ^? | sed s/^?// | xargs -r -i svn add &#8220;{}&#8221;</p></blockquote>
<p>As indicated above, this command should prepare all files you have just copied to the RWC to be committed to the SVN repository.  The final step is to run the actual &#8220;commit&#8221; command, and you would do that as so:</p>
<blockquote><p>svn commit -m &#8220;Website Backup&#8221; /remoteWorkingCopy/</p></blockquote>
<p>This command will go through the RWC and send all the new files you just added to the SVN repository where they are versioned and backed up.</p>
<p><strong>Set Up Automatic Website Updates on POST-COMMIT:</strong></p>
<p>We now have copy of the website stored in the SVN repository, as well as in the Remote Working Copy, but unless we take further steps, these filesystems will very shortly be out-of-date with the LIVE website.  We also don&#8217;t yet have a way to get changes that we make to the SVN files back onto the website.</p>
<p>In order to do this we will need to set up a POST-COMMIT hook script.  This is a script in the SVN repository which runs after every time a commit is called.  In order to install the script, simply place it in your /svnRepository/hooks/ folder and make it writable.  The script is as follows:</p>
<blockquote><p>#!/bin/sh</p>
<p># POST-COMMIT HOOK</p>
<p># Website BasePath<br />
BASEPATH=&#8221;/www&#8221;</p>
<p># Repository Path<br />
REPOSITORY=&#8221;file:///svnRepository&#8221;</p>
<p># Remote Working copy<br />
LOCALWC=&#8221;/remoteWorkingCopy/&#8221;</p>
<p>REPOS=&#8221;$1&#8243;<br />
REV=&#8221;$2&#8243;</p>
<p># Update the current working copy<br />
echo &#8220;Updating the working copy &#8221; $LOCALWC<br />
svn update $LOCALWC</p>
<p># Propogate deletes, adds and modifies from the SVN repository to the website.<br />
echo &#8220;Doing Deletes!&#8221;<br />
svn log -qvr $REV $LOCALWC | grep &#8220;^   D&#8221; | sed &#8220;s/^   D //&#8221; | sed -r &#8220;s# \(.+\)##&#8221; | xargs -r -i rm -rf $BASEPATH{}</p>
<p>echo &#8220;Doing Adds!&#8221;<br />
svn log -qvr $REV $LOCALWC | grep &#8220;^   A&#8221; | sed &#8220;s/^   A //&#8221; | sed -r &#8220;s# \(.+\)##&#8221; | xargs -r -i svn export &#8211;force $LOCALWC{} $BASEPATH{}</p>
<p>echo &#8220;Doing Mods!&#8221;<br />
svn log -qvr $REV $LOCALWC | grep &#8220;^   M&#8221; | sed &#8220;s/^   M //&#8221; | sed -r &#8220;s# \(.+\)##&#8221; | xargs -r -i svn export &#8211;force $LOCALWC{} $BASEPATH{}</p>
<p># Copy current website files to current working copy<br />
echo &#8220;Copying current website files to working copy&#8221;<br />
cp -r $BASEPATH/* $LOCALWC<br />
cp -r $BASEPATH/.ht* $LOCALWC</p>
<p># Automatically add all added and changed files from the website to the SVN repository.<br />
echo &#8220;Adding and changing files&#8221;<br />
svn stat $LOCALWC | grep ^? | sed s/^?// | xargs -r -i svn add &#8220;{}&#8221;</p>
<p># Commit changes from working copy to SVN Repository<br />
echo &#8220;Running commit&#8221;<br />
svn commit -m &#8220;Website Backup&#8221; $LOCALWC</p></blockquote>
<p>When you put this script in your /svnRepository/hooks folder and make it executable, the script will be run every time you commit something to the repository.  Here is an outline of what it does:</p>
<p><strong>Steps in Detail on Commit:</strong></p>
<ol>
<li>User runs UPDATE on their local machine to get latest info from repository</li>
<li>COMMIT is called</li>
<li>UPDATE the remote working copy.</li>
<li>Check svn log for deleted files in the Remote Working Copy and remove them from the website.</li>
<li>Check svn log for added files and export them to the website.</li>
<li>Check svn log for modified files and export them to the website.</li>
<li>Copy all live website files to Remote Working Copy.</li>
<li>Add all new files to be versioned in the RWC.</li>
<li>Commit all additions and changes from the RWC to the SVN repository.</li>
<li>The next time the user runs an update, it would get the latest files from the repository which should be synced to the website.</li>
</ol>
<p><strong>Conclusion:</strong></p>
<p>The end result of this process is that when changes are made on your local machine and committed to the SVN repository, the script will run, it will synchronize the website with the RWC and then will deploy your changes TO the website.</p>
<p>I hope you have found this tutorial useful.  As mentioned above, be very careful as you work through the process of running these scripts and commands, as you could potentially cause major breakdowns on your website.  <strong>Again, we take NO RESPONSIBILITY for any problems which may result from following this tutorial.  Follow these instructions at your own risk.</strong></p>
<p>I would love to hear any feedback you may have about this article.  I would also like to hear from developers who may have more experience with this topic than I do and would be willing to make suggestions for improvement.</p>
<p><a id="references" name="references"><strong>References:</strong></a></p>
<ol>
<li><a href="http://en.wikipedia.org/wiki/Subversion_(software)">Subversion (software)</a> &#8211; From Wikipedia, the free encyclopedia</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2008/04/website-subversion-backup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FormBuilder WordPress Plugin</title>
		<link>http://www.warkensoft.com/2008/04/formbuilder-wordpress-plugin/</link>
		<comments>http://www.warkensoft.com/2008/04/formbuilder-wordpress-plugin/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 20:21:31 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/?p=60</guid>
		<description><![CDATA[I am very excited to announce the public (beta) release of the FormBuilder WordPress plugin on WordPress.org.  FormBuilder is a project which was inspired, in part, by my work on FormContact 1.0 and came about as a result of our need for a good yet simple form building utility for WordPress.
The plugin was developed [...]]]></description>
			<content:encoded><![CDATA[<p>I am very excited to announce the public (beta) release of the <a href="http://truthmedia.com/wordpress/formbuilder/">FormBuilder WordPress plugin</a> on <a href="http://wordpress.org/extend/plugins/formbuilder/">WordPress.org</a>.  FormBuilder is a project which was inspired, in part, by my work on FormContact 1.0 and came about as a result of our need for a good yet simple form building utility for WordPress.</p>
<p>The plugin was developed by me while working for TruthMedia.  At the time of writing, it is at v. 0.57 and is compatible with WordPress 1.5 &#8211; 2.5.  If you have a WordPress blog already, why not check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2008/04/formbuilder-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where to Start with PHP Programming</title>
		<link>http://www.warkensoft.com/2006/10/where-to-start-with-php-programming/</link>
		<comments>http://www.warkensoft.com/2006/10/where-to-start-with-php-programming/#comments</comments>
		<pubDate>Sun, 08 Oct 2006 05:25:22 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP Programming]]></category>

		<guid isPermaLink="false">http://www.warkensoft.com/2006/10/where-to-start-with-php-programming/</guid>
		<description><![CDATA[I&#8217;m going to start this tutorial with an assumption. I&#8217;m going to assume that you, the reader, already have access to a PHP enabled server. My specialization is programming, not server setup, so I&#8217;ll leave that part out of this. If for some reason, you DON&#8217;T yet have access to a PHP enabled server, or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to start this tutorial with an assumption. I&#8217;m going to assume that you, the reader, already have access to a PHP enabled server. My specialization is programming, not server setup, so I&#8217;ll leave that part out of this. If for some reason, you DON&#8217;T yet have access to a PHP enabled server, or you are wanting to install your own, I recommend hosting with <a href="http://phpads.warkensoft.com/adclick.php?bannerid=7&#038;zoneid=9&#038;source=&#038;dest=http://www.warkensoft.com/2006/10/hosting-coupons/&#038;ismap=">DreamHost</a>.  They&#8217;re VERY good, offer great PHP server support and are very inexpensive.  <a href="http://www.warkensoft.com/2007/03/where-to-start-with-a-website/">Click here for more information on how to START building a website.</a></p>
<p>First off, a little discussion about the nature of PHP. PHP is a server side scripting language, which means that it runs stuff on the server, and returns the results of that process to the web browser of the person who ran it.</p>
<blockquote><p><strong>Example:</strong> When somone on a website clicks &#8220;Submit&#8221; on a contact form, the server receives the data but doesn&#8217;t inherently know what to do with that data. This is where PHP comes in. If the data is submitted to a PHP script on the server, that script can then take that data and email it to someone or stick it in a database.</p></blockquote>
<p>A PHP script can be as simple as a single line of code to do a math calculation, or complex enough to run an entire website. The format of PHP code is similar to C but in my opinion, is much more forgiving.</p>
<h4>A Little About Style</h4>
<p>One of the most important lessons to be learned by any coder, even before you really get into much of it, is code documentation. In my opinion, one of the worse problem with many coders is that they don&#8217;t know how to document their code. This will be a pain both to you when you want to go back and edit something, and to anyone else who needs to use your code. I can&#8217;t say this strongly enough. LEARN TO DOCUMENT ALL YOUR CODE! I&#8217;m not talking so much about pages of documentation in addition to the script you are writing. Rather, I&#8217;m talking about writing out in the code itself, what you&#8217;re doing with each statement or set of statements. You will appreciate it in the future, when you come back to a script and want to figure out what it does, and other programmers who may use your work, will also bless you. It&#8217;s also a pretty key factor in getting hired in this industry. If an employer knows what they&#8217;re doing, they&#8217;re going to have someone look through your code to make sure it&#8217;s well formed and not going to cause their other programmers headaches.</p>
<h4>Keys to Good Style</h4>
<ol>
<li><strong>In Code Documentation</strong><br />
As I&#8217;ve mentioned above, get in the habit of writing plain text explainations for what you&#8217;re doing in the code you&#8217;re designing. It&#8217;s not difficult to put in a bit of text before a segment of code to explain what you&#8217;re going to be doing.</li>
<li><strong>Clear and Appropriate Variable Names</strong><br />
While coding, you&#8217;re most likely going to be declaring variables. (Variables are like boxes of information stored in memory) The more clearly you name your variables, the better off you&#8217;ll be later, and the less likely you are to run into conflicts or confusion.</li>
</ol>
<h4>Some Examples</h4>
<p>Well, let&#8217;s take a look at some PHP Code now so we get the feel  						    	for what we&#8217;re looking at.</p>
<p>A standard PHP script will be enclosed in tags like this:<br />
<code><?PHP<br />
# Some php commands here<br />
?></code><br />
There are some variations of this as well. For example, some servers will allow you to simply use <code><?</code> instead of <code><?PHP</code>. Usually though, it's good form to use the full <code><?PHP</code> for clarity.</p>
<p>Now, let's take a look at some examples of good code documentation  						    	and bad code documentation.<br />
<strong>Poor Code Style:</strong><br />
<code><? $x="Some text"; $y="some more text"; $z=$x.$y; echo "Combined  text variables = ".$z ; ?></code></p>
<p><strong>Better Code Style: </strong><br />
<code><br />
<?PHP<br />
# Declare some text variables<br />
$text_1 = "Some text ";<br />
$text_2 = "some  						    		more text";</p>
<p># Combine the two previous variables into a third variable<br />
$text_combined = $text_1 . $text_2;</p>
<p># Print out the results<br />
echo "Combined text variables  = " . $text_combined;<br />
?><br />
</code></p>
<p><strong>Output:</strong><br />
Combined text variables = Some text some more text</p>
<p>Both of these examples would print out the same result to the browser, but you'll notice that in the second example, I've added line breaks in appropriate places, used more appropriate variable names, and have added comments before each segment of code. (comments are denoted in PHP by a # sign at the beginning of a line) You could even go so far as to add comments to the very beginning of the script, explaining when it was made and what it's purpose was. See this example...</p>
<p class="phpScript"><strong>Better Code Style: </strong><br />
<code><br />
<?PHP</p>
<p># Sample PHP Programming Script<br />
# Designed Nov. 18, 2005<br />
# Used on "Where to Start PHP Programming" as an example of  good<br />
# programming style.</p>
<p># Declare some text variables<br />
$text_1 = "Some text ";<br />
$text_2 = "some more text";</p>
<p># Combine the two previous variables into a third variable<br />
$text_combined = $text_1 . $text_2;</p>
<p># Print out the results<br />
echo "Combined text variables = " . $text_combined;<br />
?></code></p>
<p>So what do you think? Still want to be a PHP Programmer? I hope  						    	so... It can be a lot of fun.</p>
<p>In the next few tutorials we'll start going over some of the basic programming structures and commands that you'll be using as you start coding. You may also find it useful to get a book like the one I've recommended at the top of this page. These tutorials will give you the basics and help you to get started, but if you want to get into more complex coding, a book like this one is the way to go.</p>
<blockquote><p><a href="http://www.amazon.ca/exec/obidos/redirect?link_code=ur2&#038;tag=warkensoftpro-20&#038;camp=15121&#038;creative=330641&#038;path=http://www.amazon.com/gp/product/1931841322?v=glance%26n=283155%26n=507846%26s=books%26v=glance">PHP/MySQL                                  		Programming for the Absolute Beginner</a></p></blockquote>
<p>** Author's Note: More tutorials will be coming as soon as I get time to write them.  If you have a suggested topic or article that you would like to submit as a tutorial, I'd love to work with you on it.  </p>
<blockquote>
<div>
	<div class='democracy'>
		<strong class="poll-question">What topics should the next PHP Programming lesson cover?</strong>
		<div class='dem-results'>
		<form action='http://www.warkensoft.com/wp-content/plugins/democracy/democracy.php' onsubmit='return dem_Vote(this)'>
		<ul>
			<li>
					<input type='radio' id='dem-choice-6' value='6' name='dem_poll_2' />
					<label for='dem-choice-6'>Variables</label>
			</li>
			<li>
					<input type='radio' id='dem-choice-7' value='7' name='dem_poll_2' />
					<label for='dem-choice-7'>Hello World</label>
			</li>
			<li>
					<input type='radio' id='dem-choice-8' value='8' name='dem_poll_2' />
					<label for='dem-choice-8'>Banners</label>
			</li>
			<li>
					<input type='radio' id='dem-choice-18' value='18' name='dem_poll_2' />
					<label for='dem-choice-18'>test</label>
			</li>
			<li> <a href='/category/php-programming/feed/?dem_add_user_answer=true&dem_poll_id=2' rel='nofollow' onclick='return dem_addAnswer(this)' class='dem-add-answer'>Add an Answer</a>
			</li>
		</ul>
			<input type='hidden' name='dem_poll_id' value='2' />
			<input type='hidden' name='dem_action' value='vote' />
			<input type='submit' class='dem-vote-button' value='Vote' />
			<a href='/category/php-programming/feed/?dem_action=view&amp;dem_poll_id=2' onclick='return dem_getVotes("http://www.warkensoft.com/wp-content/plugins/democracy/democracy.php?dem_action=view&amp;dem_poll_id=2", this)' rel='nofollow' class='dem-vote-link'>View Results</a>
		</form>
		</div>
	</div></div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.warkensoft.com/2006/10/where-to-start-with-php-programming/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
