<?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"
	>

<channel>
	<title>The Tutorial Blog</title>
	<atom:link href="http://www.thetutorialblog.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thetutorialblog.com</link>
	<description></description>
	<pubDate>Tue, 30 Jun 2009 20:43:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>jQuery Form Validation</title>
		<link>http://www.thetutorialblog.com/2009/06/30/jquery-form-validation/</link>
		<comments>http://www.thetutorialblog.com/2009/06/30/jquery-form-validation/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 20:38:47 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Video Tutorials]]></category>

		<category><![CDATA[help]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[html]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[web design]]></category>

		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=82</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Create a form that requires the user to enter both a username and password. If the username field or password field is left blank then a message will be displayed.

]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>Create a form that requires the user to enter both a username and password. If the username field or password field is left blank then a message will be displayed.</p>
<p><object type="application/x-shockwave-flash" width="512" height="399" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" ><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf" /><param name="flashvars" value="init=http://blip.tv/play/AYGN4GwA" /><embed src="http://blip.tv/play/AYGN4GwA" type="application/x-shockwave-flash" width="512" height="399" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2009/06/30/jquery-form-validation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jQuery #1</title>
		<link>http://www.thetutorialblog.com/2009/06/28/jquery-1/</link>
		<comments>http://www.thetutorialblog.com/2009/06/28/jquery-1/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 22:45:40 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Video Tutorials]]></category>

		<category><![CDATA[animate]]></category>

		<category><![CDATA[blip]]></category>

		<category><![CDATA[blip.tv]]></category>

		<category><![CDATA[effect]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[help]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[jquery]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=73</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Learn how to use the animate function within the jQuery library to create an effect similar to the table of contents for the table of contents on codeigniter.com. 
Blip.tv Link

																				
															Click to play					
										
]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>Learn how to use the animate function within the jQuery library to create an effect similar to the table of contents for the table of contents on codeigniter.com. </p>
<p><a href="http://thetutorialblog.blip.tv/file/2296444/">Blip.tv Link</a></p>
<p><span id="more-73"></span></p>
<p><center>															<script type="text/javascript" src="http://blip.tv/scripts/pokkariPlayer.js?ver=2008010901"></script>					<script type="text/javascript" src="http://blip.tv/syndication/write_player?skin=js&#038;posts_id=2312660&#038;source=3&#038;autoplay=true&#038;file_type=flv&#038;player_width=1024&#038;player_height=768"></script>
<div id="blip_movie_content_2312660">					<a rel="enclosure" href="http://blip.tv/file/get/Thetutorialblog-jQuery1834.flv" onclick="play_blip_movie_2312660(); return false;"><img title="Click to play" alt="Video thumbnail. Click to play" width="512" height="384" src="http://blip.tv/file/get/Thetutorialblog-jQuery1834.flv.jpg" border="0" title="Click to play" /></a>					<br />					<a rel="enclosure" href="http://blip.tv/file/get/Thetutorialblog-jQuery1834.flv" onclick="play_blip_movie_2312660(); return false;">Click to play</a>					</div>
<p>										</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2009/06/28/jquery-1/feed/</wfw:commentRss>
<enclosure url="http://blip.tv/file/get/Thetutorialblog-jQuery1652.mov" length="34276983" type="video/quicktime" />
<enclosure url="http://blip.tv/file/get/Thetutorialblog-jQuery1834.flv" length="32154787" type="video/x-flv" />
		</item>
		<item>
		<title>Redesign</title>
		<link>http://www.thetutorialblog.com/2009/05/23/redesign/</link>
		<comments>http://www.thetutorialblog.com/2009/05/23/redesign/#comments</comments>
		<pubDate>Sat, 23 May 2009 14:54:24 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[redesign]]></category>

		<category><![CDATA[screencasts]]></category>

		<category><![CDATA[Video Tutorials]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=69</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Over the next few weeks I am going to be completely redesigning the whole of TheTutorialBlog so that it is a lot more user friendly. From that point on I will be creating high quality video tutorials very often so that they are easy to follow and viewers learn more.
I may also be interested in [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>Over the next few weeks I am going to be completely redesigning the whole of TheTutorialBlog so that it is a lot more user friendly. From that point on I will be creating high quality video tutorials very often so that they are easy to follow and viewers learn more.</p>
<p>I may also be interested in having other people write tutorials and create screencasts; so please get in touch if you think you are capable of doing this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2009/05/23/redesign/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Basic PHP Statistics Script</title>
		<link>http://www.thetutorialblog.com/2009/03/08/a-basic-php-statistics-script/</link>
		<comments>http://www.thetutorialblog.com/2009/03/08/a-basic-php-statistics-script/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 23:08:01 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[$_SERVER['REQUEST_URI'];]]></category>

		<category><![CDATA[array]]></category>

		<category><![CDATA[array_count_values]]></category>

		<category><![CDATA[array_push]]></category>

		<category><![CDATA[explode]]></category>

		<category><![CDATA[fclose]]></category>

		<category><![CDATA[fgets]]></category>

		<category><![CDATA[fopen]]></category>

		<category><![CDATA[foreach]]></category>

		<category><![CDATA[fwrite]]></category>

		<category><![CDATA[scandir]]></category>

		<category><![CDATA[script]]></category>

		<category><![CDATA[statistics]]></category>

		<category><![CDATA[substr]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=61</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	
In this tutorial you will learn about writing information to a text file and then retrieving the information you wrote to the text file. Retrieving the files that are in a directory and about arrays.
This is a quite basic script and there isn't much to write about it so if there is something that you [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p><object width="480" height="392" data="http://flash.revver.com/player/1.0/player.swf?mediaId=1525556&#038;affiliateId=42154" type="application/x-shockwave-flash" id="revvervideoa17743d6aebf486ece24053f35e1aa23"><param name="Movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=1525556&#038;affiliateId=42154"></param><param name="FlashVars" value="allowFullScreen=true&#038;backColor=#000000&#038;frontColor=#ffffff&#038;gradColor=#000000"></param><param name="AllowFullScreen" value="true"></param><param name="AllowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://flash.revver.com/player/1.0/player.swf?mediaId=1525556&#038;affiliateId=42154" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" flashvars="allowFullScreen=true&#038;backColor=#000000&#038;frontColor=#ffffff&#038;gradColor=#000000" allowfullscreen="true" width="480" height="392"></embed></object></p>
<p>In this tutorial you will learn about writing information to a text file and then retrieving the information you wrote to the text file. Retrieving the files that are in a directory and about arrays.</p>
<p>This is a quite basic script and there isn't much to write about it so if there is something that you don't understand look the function up within the PHP manual online.<br />
<span id="more-61"></span></p>
<h2>Step 1</h2>
<p>In the first step we are going to get the current page that we are at and store it within a variable. The information in that variable will then be wrote to a file called <em>stats.txt.</em></p>
<p>Include the following code in the pages that you want the number of visits to be counted for. If you have a file such as a header file than put this code in there.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// write current page to stats file</span>
<span style="color: #000088;">$cur_page</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cur_page</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$cur_page</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'index.php'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;stats.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a+&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cur_page</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h2>Step 2</h2>
<p>The next piece of code that we are going to write is going to retrieve the information in <em>stats.txt</em> and put it into an array. We then use the function <em>array_count_values</em> to see how many times the page url occurs. We also retrieve the files in the directory which this script is in to compare them with the files in <em>stats.txt</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;stats.txt&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> scandir<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$num_files</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_files</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000088;">$num_cv</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_count_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_files</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num_cv</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$f</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">echo</span> <span style="color: #0000ff;">'file: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$f</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' - '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If you have any other alternatives or need any help then feel free to post a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2009/03/08/a-basic-php-statistics-script/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Tutorials?</title>
		<link>http://www.thetutorialblog.com/2009/01/27/new-tutorials/</link>
		<comments>http://www.thetutorialblog.com/2009/01/27/new-tutorials/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 21:47:37 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=59</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	What kind of new tutorials would you like to see on this website?
Post a comment or email me (wez [at] thetutorialblog.com) and let me know and I will start writing tutorials on things that you would like to see posted on here.
]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>What kind of new tutorials would you like to see on this website?</p>
<p>Post a comment or email me (wez [at] thetutorialblog.com) and let me know and I will start writing tutorials on things that you would like to see posted on here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2009/01/27/new-tutorials/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Boosting traffic to your website with submission websites</title>
		<link>http://www.thetutorialblog.com/2008/11/21/boosting-traffic-to-your-website-with-submission-websites/</link>
		<comments>http://www.thetutorialblog.com/2008/11/21/boosting-traffic-to-your-website-with-submission-websites/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 17:45:55 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[asp.net]]></category>

		<category><![CDATA[codebounce]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[graphic design]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[learn]]></category>

		<category><![CDATA[learnphp]]></category>

		<category><![CDATA[Photoshop]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[submission]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[tutorial submission]]></category>

		<category><![CDATA[tutorialized]]></category>

		<category><![CDATA[visitors]]></category>

		<category><![CDATA[web design]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=49</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	There are many ways of getting traffic to your website such as with search engines, social network websites and telling friends. The best way that I have found besides search engines of getting traffic to your website is by submitting your tutorials to tutorial submission websites.
There are tutorial websites that allow for submission of specific [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>There are many ways of getting traffic to your website such as with search engines, social network websites and telling friends. The best way that I have found besides search engines of getting traffic to your website is by submitting your tutorials to tutorial submission websites.</p>
<p>There are tutorial websites that allow for submission of specific tutorials such as only PHP or Photoshop tutorials and there are websites that allow you to submit a lot of different types of tutorials to that website.</p>
<p><a href="http://www.codebounce.com" target="_blank"><img class="alignnone size-full wp-image-50" title="codebounce" src="http://www.thetutorialblog.com/wp-content/uploads/2008/11/codebounce.png" alt="" width="315" height="58" /></a><br />
<a href="http://www.codebounce.com">CodeBounce</a> is one of the tutorial submission websites that allow you to submit a range of different tutorials. Its system is somewhat similar to that of Digg's. CodeBounce is a great website and is easy to get to grips with. They allow for the submission of ASP.NET, PHP, CSS, Photoshop, Wordpress, Graphic Design, Web Design and Java.<br />
<a href="http://www.codebounce.com">Developer Links and Tutorials</a>.<br />
<span id="more-49"></span> </p>
<p><a href="http://www.learnphp.org"><img class="alignnone size-full wp-image-52" title="learnphp" src="http://www.thetutorialblog.com/wp-content/uploads/2008/11/learnphp.png" alt="" width="256" height="83" /></a><br />
LearnPHP is a website that I recommend submitting your PHP tutorials too because I receive a lot of visitors from them and overall the website is easy to navigate and understand. They only allow for the submission of PHP tutorials as you can probably tell from the name.</p>
<p><a href="http://www.tutorialized.com/"></a><a href="http://www.tutorialized.com"><img class="alignnone size-full wp-image-56" title="tutorialized1" src="http://www.thetutorialblog.com/wp-content/uploads/2008/11/tutorialized1.png" alt="" width="325" height="85" /></a><br />
Tutorialized is a great website that allows for the submission of many different types of tutorials. Tutorialized has been a website that has been around for a long time and if you submit a tutorial to this website and you get accepted then expect quite a lot of hits from here as they have a lot of visitors.</p>
<p> </p>
<p>If there are any other websites that you like submitting tutorials too and have received a good amount of visitors from then share it with everyone and let us know by posting a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2008/11/21/boosting-traffic-to-your-website-with-submission-websites/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating a Wordpress plugin</title>
		<link>http://www.thetutorialblog.com/2008/11/21/creating-a-wordpress-plugin/</link>
		<comments>http://www.thetutorialblog.com/2008/11/21/creating-a-wordpress-plugin/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 17:10:34 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Text Tutorials]]></category>

		<category><![CDATA[create]]></category>

		<category><![CDATA[help]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[makeuseof]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=38</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	The plugin that I'm going to show you how to create within this post is a plugin that I created for MakeUseOf.
Creating plugins for WP is relatively easy and uses actions to call functions that are included in pages within the main WP files. To learn more about creating plugins for WP go here.
Ok so [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>The plugin that I'm going to show you how to create within this post is a plugin that I created for <a href="http://www.makeuseof.com" target="_blank">MakeUseOf</a>.</p>
<p>Creating plugins for WP is relatively easy and uses actions to call functions that are included in pages within the main WP files. To learn more about creating plugins for WP go <a href="http://codex.wordpress.org/Main_Page" target="_blank">here</a>.</p>
<p>Ok so lets get started with creating the plugin.</p>
<p>When creating a plugin for WP make sure that you include your own unique word or acronym to your functions so that they don't conflict with any other plugins that may be installed.</p>
<p>Because I created this for MakeUseOf the acronym I use is MUO and then AF because I named the plugin author footer so every function within this plugin begins with MUO_AF.<br />
<span id="more-38"></span><br />
So to start our plugin we add this<br />
<div id="code_div">&lt;?php<br />
/*<br />
Plugin Name: MUO Author Footer<br />
Description: Authors type in the footer that will be attached to the end of their articles with modifications<br />
Author: Wez<br />
Version: 1.0<br />
*/<br />
</div></p>
<p>Here is where we add the name of our plugin, a description, your name and the version number of your plugin.</p>
<p>The next bit of code that we add is the <em>register_activation_hook</em> and <em>register_deactivation_hook</em> so that when the plugin is activated and deactivated the code within functions that we will create in our next step will be executed.<br />
<div id="code_div">register_activation_hook(__FILE__, 'MUO_AF_activate');<br />
register_deactivation_hook(__FILE__, 'MUO_AF_deactivate');</div></p>
<p>We're now going to create two functions called MUO_AF_activate and MUO_AF_deactivate so that the register hooks work correctly.<br />
<div id="code_div">function MUO_AF_activate() {<br />
	$query = mysql_query("CREATE TABLE `muo_author_footer` (<br />
	  `author_id` int(11) NOT NULL,<br />
	  `author_name` varchar(50) NOT NULL,<br />
	  `author_signature` text NOT NULL,<br />
	  PRIMARY KEY  (`author_id`)<br />
	) ENGINE=MyISAM DEFAULT CHARSET=latin1;");<br />
}</p>
<p>function MUO_AF_deactivate(){<br />
	$query = mysql_query("DROP TABLE `muo_author_footer`");<br />
}</div><br />
What this code does is when the plugin is activated it will create a table within the MySQL database that the plugin will use to store and retrieve information. When the plugin is deactivated it will delete the table that was created in the database.</p>
<p>In the next step we will write code that will be called and displayed within the Your Profile page in the admin-cp.<br />
<div id="code_div">function MUO_AF_profile() {<br />
	global $userdata;<br />
	get_currentuserinfo();<br />
	$query = mysql_query("SELECT * FROM muo_author_footer WHERE author_id='$userdata->ID'");<br />
	$row = mysql_fetch_array($query);<br />
	$author_signature = $row['author_signature'];<br />
	echo '&lt;table class="form-table"><br />
	&lt;tr>&lt;th>Author Post Signature</th>
<p>	&lt;td>&lt;p><br />
	&lt;textarea name="MUO_Author_Sig" cols="30" rows="5">'.$author_signature.'&lt;/textarea><br />
	&lt;/p><br />
	&lt;h2>Preview:&lt;/h2>&lt;p>&lt;em>';<br />
	echo $author_signature;<br />
	echo '&lt;/em>&lt;/p><br />
	&lt;/td>&lt;/tr><br />
	&lt;/table>';<br />
}</div></p>
<p>When the Update Profile button is clicked the information from the previous bit of code will be retrieved in the next bit of code and the database will be updated.<br />
<div id="code_div">function MUO_AF_edit(){<br />
	global $userdata, $current_user;<br />
	get_currentuserinfo();</p>
<p>	$MUO_Author_Sig = $_POST['MUO_Author_Sig'];</p>
<p>	$query = mysql_query("SELECT * FROM muo_author_footer WHERE author_id='$userdata->ID'");</p>
<p>	if( mysql_num_rows($query) > 0 ) {<br />
		$query = mysql_query("UPDATE muo_author_footer SET author_signature='$MUO_Author_Sig' WHERE author_id='$userdata->ID'");<br />
	} else {<br />
		$query = mysql_query("INSERT INTO muo_author_footer VALUES ('$userdata->ID','$userdata->user_login','$MUO_Author_Sig')");<br />
	}</p>
<p>}</div></p>
<p>The code we will write now is the code that will grab the contents of the post and then attach the authors signature to the end of that post.<br />
<div id="code_div">function MUO_AF_publish_post( $content ) {<br />
	global $wpdb;<br />
	$num = 0;<br />
	if (get_the_ID() > $num) {<br />
		$the_author_id = get_the_author_id();<br />
		$author_query = mysql_query("SELECT * FROM muo_author_footer WHERE author_id='". $the_author_id ."'");<br />
		$author_row = mysql_fetch_array($author_query);<br />
		$author_signature = $author_row['author_signature'];</p>
<p>		$content .= '&lt;style><br />
					.muo_af_style { background-color: #B4D0E1; border: 2px solid #4275B8; }<br />
					&lt;/style>';</p>
<p>		if(strstr($author_signature, 'by') == false) :</p>
<p>		$content .= '&lt;p class="muo_af_style">&lt;em>(By) '.$author_signature.'&lt;/em>&lt;/p>';</p>
<p>		else :</p>
<p>		$content .= '&lt;p class="muo_af_style">&lt;em>'.$author_signature.'&lt;/em>&lt;/p>';</p>
<p>		endif;</p>
<p>		return $content;<br />
	}<br />
	else {<br />
		return $content;<br />
	}<br />
}</div></p>
<p>We will now add the functions to actions, this is the most important part of the code because without this none of the functions would be called and nothing would happen.<br />
<div id="code_div">add_action('show_user_profile', 'MUO_AF_profile');<br />
add_filter('profile_update', 'MUO_AF_edit');<br />
add_action('the_content', 'MUO_AF_publish_post');<br />
</div></p>
<p>Then at the end of the file close the php tags with<br />
<div id="code_div">?></div></p>
<p>I have not been very descriptive in this tutorial of what the actual code within the plugin is doing because I created this tutorial wanting to show people the basics bit of code that are needed to call functions and make a plugin work.</p>
<p>I hope that you have learnt something by reading this tutorial and feel free to post a comment with your thoughts on this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2008/11/21/creating-a-wordpress-plugin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Basic iPhone Button</title>
		<link>http://www.thetutorialblog.com/2008/10/21/basic-iphone-button/</link>
		<comments>http://www.thetutorialblog.com/2008/10/21/basic-iphone-button/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 00:35:07 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[Cocoa/Objective-C]]></category>

		<category><![CDATA[basic]]></category>

		<category><![CDATA[beginner]]></category>

		<category><![CDATA[cocoa]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[objc]]></category>

		<category><![CDATA[objective-c]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=36</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	
]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p><object width="480" height="392" data="http://flash.revver.com/player/1.0/player.swf?mediaId=1266381&#038;affiliateId=42154" type="application/x-shockwave-flash" id="revvervideoa17743d6aebf486ece24053f35e1aa23"><param name="Movie" value="http://flash.revver.com/player/1.0/player.swf?mediaId=1266381&#038;affiliateId=42154"></param><param name="FlashVars" value="allowFullScreen=true&#038;backColor=#000000&#038;frontColor=#ffffff&#038;gradColor=#000000"></param><param name="AllowFullScreen" value="true"></param><param name="AllowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://flash.revver.com/player/1.0/player.swf?mediaId=1266381&#038;affiliateId=42154" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" flashvars="allowFullScreen=true&#038;backColor=#000000&#038;frontColor=#ffffff&#038;gradColor=#000000" allowfullscreen="true" width="480" height="392"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2008/10/21/basic-iphone-button/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP One Line IF Statement</title>
		<link>http://www.thetutorialblog.com/2008/08/27/php-one-line-if-statement/</link>
		<comments>http://www.thetutorialblog.com/2008/08/27/php-one-line-if-statement/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 22:31:31 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Text Tutorials]]></category>

		<category><![CDATA[else]]></category>

		<category><![CDATA[if]]></category>

		<category><![CDATA[quicktip]]></category>

		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=35</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	I'm sure if you've been programming for a few years that you've come across when you need to check if something equals something than do something else a few times.
Well the best way to do this is like so.
Say for example we have a variable called $num and the value of it is 5.

You could [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>I'm sure if you've been programming for a few years that you've come across when you need to check if something equals something than do something else a few times.</p>
<p>Well the best way to do this is like so.</p>
<p>Say for example we have a variable called $num and the value of it is 5.<br />
<span id="more-35"></span><br />
You could store it in a variable.<br />
<div id="code_div">$code = ($num &gt; 0) ? "More than 0" : "Less than 0";</div></p>
<p>or you could print it straight to the users browsers<br />
<div id="code_div">($num &gt; 0) ? "More than 0": "Less than 0";</div></p>
<p>So what happens here is if $num is greater than 0 print More than 0 else print Less than 0.</p>
<p>I hope you've found this quick tip helpful and use it throughout future projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2008/08/27/php-one-line-if-statement/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP News System Part 4</title>
		<link>http://www.thetutorialblog.com/2008/08/17/php-news-system-part-4/</link>
		<comments>http://www.thetutorialblog.com/2008/08/17/php-news-system-part-4/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 23:15:05 +0000</pubDate>
		<dc:creator>Wez</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Text Tutorials]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[db]]></category>

		<category><![CDATA[delete]]></category>

		<category><![CDATA[edit]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[news]]></category>

		<category><![CDATA[news system]]></category>

		<category><![CDATA[part 4]]></category>

		<category><![CDATA[post]]></category>

		<category><![CDATA[remove]]></category>

		<category><![CDATA[thetutorialblog]]></category>

		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=34</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	If you haven't checked out the previous tutorials then click on the names to view them. Part 1, Part 2, Part3.
In Part 4 of this tutorial you are going to learn how to edit and delete your posts from the admin page.

Connect to the database
The first thing that we need to do is go to [...]]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<p>If you haven't checked out the previous tutorials then click on the names to view them. <a href="http://www.thetutorialblog.com/2008/06/17/php-news-system-part-1-with-sound/">Part 1</a>, <a href="http://www.thetutorialblog.com/2008/07/30/php-news-system-part-2/">Part 2</a>, <a href="http://www.thetutorialblog.com/2008/08/01/php-news-system-part-3/">Part3</a>.</p>
<p>In Part 4 of this tutorial you are going to learn how to edit and delete your posts from the admin page.<br />
<span id="more-34"></span></p>
<h2>Connect to the database</h2>
<p>The first thing that we need to do is go to <strong>index.php</strong> under the admin folder and to the after the first <strong>&lt;?php </strong>add this:</p>
<p><div id="code_div">include("../dbconnect.php");</div></p>
<h2>Display The Posts</h2>
<p>After this line in index.php<br />
<div id="code_div">echo "&lt;a href="newpost.php">New Post&lt;/a>";</div></p>
<p>add below it<br />
<div id="code_div">echo "&lt;br>";<br />
		echo "&lt;br>";<br />
		echo "Edit Posts &lt;br>";</p>
<p>		$query = mysql_query("SELECT * FROM news_system ORDER BY id DESC");<br />
		while ( $row = mysql_fetch_array( $query ) ) {<br />
			$id = $row['id'];<br />
			$author = $row['author'];<br />
			$title = $row['title'];</p>
<p>			echo '&lt;a href="editpost.php?id='.$id.'">'.$title.' - By '.$author.'&lt;/a>&lt;br>';<br />
		}<br />
	}<br />
</div></p>
<p>What we're doing here is querying the database to display all the posts in the table <em>news_system</em> from the newest post to the oldest post. We then use a while loop to loop through and display each post. You will see that each post links to <strong>editpost.php</strong> so what we will do now is create an <strong>editpost.php</strong> file.</p>
<h2>Creating editpost.php</h2>
<p>After you have created your editpost.php file add the following code to it<br />
<div id="code_div">&lt;?php<br />
include("../dbconnect.php");</p>
<p>$id = $_GET['id'];</p>
<p>?></div></p>
<p>What we're doing here is opening the php tags then including <strong>dbconnect.php</strong> that connects to the database. <em>$_GET['id']</em> gets the id from the URL and stores it in a variable called <em>$id</em>. Then we close the php tags with <em>?></em>.</p>
<p>Before the <em>?></em> insert the following code.<br />
<div id="code_div">$query = mysql_query("SELECT * FROM news_system WHERE id='$id'");<br />
$row = mysql_fetch_array($query);</p>
<p>$author = $row['author'];<br />
$date = $row['date'];<br />
$title = $row['title'];<br />
$post = $row['post'];</div><br />
What this code will do is find the row in the table <em>news_system</em> with the id that is stored in $id. Then we retrieve the author, date, title and post information.</p>
<p>Below this we're going to create a html form and display the information that we have retrieved from the database within it so that we can edit it.</p>
<p><div id="code_div">if( !$_POST['submit'] ) {<br />
	echo '&lt;form method="POST">';<br />
	echo 'Author: &lt;input type="text" name="author" value="'.$author.'"> &lt;br>';<br />
	echo 'Date: &lt;input type="text" name="date" value="'.$date.'"> &lt;br>';<br />
	echo 'Title: &lt;input type="text" name="title" value="'.$title.'"> &lt;br>';<br />
	echo 'Post: &lt;br>&lt;textarea name="post" cols="30" rows="5">'.$post.'&#038;lt'/textarea>&lt;br>';<br />
	echo '&lt;input type="hidden" name="id" value="'.$id.'">';<br />
	echo '&lt;input type="submit" name="submit" value="Edit Post">&lt;br>&lt;br>';</p>
<p>	echo '&lt;a href="deletepost.php?id='.$id.'">Delete Post&lt;/a>';<br />
} </div></p>
<p>What happens in this piece of code is if the post hasn't been submitted then include the form. Within all the form elements you'll see that they all have <em>value</em> and that value is the variables. We also include the id in a hidden element so that we can carry it over for when the submit button is pressed. Under the submit button there is a link to a page that we will create in a minute that will delete that post.</p>
<p>In the next lot of code we're going to make it retrieve all of the values from the form and store them in variables that will then be used to update the row within the table.<br />
<div id="code_div">else {<br />
	$id = $_POST['id'];<br />
	$author = $_POST['post'];<br />
	$date = $_POST['date'];<br />
	$title = $_POST['title'];<br />
	$post = $_POST['post'];</p>
<p>	$query = mysql_query("UPDATE news_system SET author='$author', date='$date', title='$title', post='$post' WHERE id='$id'");<br />
	echo 'Post was updated, &lt;a href="index.php">return home</a>';<br />
}</div><br />
Here you can see we are retrieving all the information from the form and storing the information into variables. Then we query the database to update the new values and lastly return a message to the user to know that it has been updated.</p>
<p>All the code together should look like this:<br />
<div id="code_div"><br />
&lt;?php<br />
include("../dbconnect.php");</p>
<p>$id = $_GET['id'];</p>
<p>$query = mysql_query("SELECT * FROM news_system WHERE id='$id'");<br />
$row = mysql_fetch_array($query);</p>
<p>$author = $row['author'];<br />
$date = $row['date'];<br />
$title = $row['title'];<br />
$post = $row['post'];</p>
<p>if( !$_POST['submit'] ) {<br />
	echo '&lt;form method="POST">';<br />
	echo 'Author: &lt;input type="text" name="author" value="'.$author.'"> &lt;br>';<br />
	echo 'Date: &lt;input type="text" name="date" value="'.$date.'"> &lt;br>';<br />
	echo 'Title: &lt;input type="text" name="title" value="'.$title.'"> &lt;br>';<br />
	echo 'Post: &lt;br>&lt;textarea name="post" cols="30" rows="5">'.$post.'&#038;lt'/textarea>&lt;br>';<br />
	echo '&lt;input type="hidden" name="id" value="'.$id.'">';<br />
	echo '&lt;input type="submit" name="submit" value="Edit Post">&lt;br>&lt;br>';</p>
<p>	echo '&lt;a href="deletepost.php?id='.$id.'">Delete Post&lt;/a>';<br />
} </p>
<p>else {<br />
	$id = $_POST['id'];<br />
	$author = $_POST['post'];<br />
	$date = $_POST['date'];<br />
	$title = $_POST['title'];<br />
	$post = $_POST['post'];</p>
<p>	$query = mysql_query("UPDATE news_system SET author='$author', date='$date', title='$title', post='$post' WHERE id='$id'");<br />
	echo 'Post was updated, &lt;a href="index.php">return home</a>';<br />
}<br />
?><br />
</div></p>
<p>Now that we have created the <strong>editpost.php</strong> file its time to create <strong>deletepost.php</strong>.</p>
<h2>Delete a post</h2>
<p>In this delete file I haven't added any confirmation to ask the user if they're certain that they want to delete the post. It might be a good idea to add it using submit buttons or javascript.</p>
<p><div id="code_div">&lt;?php<br />
include("../dbconnect.php");<br />
$id = $_GET['id'];</p>
<p>$query = mysql_query("DELETE FROM news_system WHERE id='$id'");</p>
<p>echo 'The post was deleted, &lt;a href="index.php">return home&lt;/a>';<br />
?></div></p>
<p>As usual we include the php tag and the database file as we're going to be querying the database. We then get the id from the URL and store it in <em>$id</em>. Then we query the database and delete the post and last of all we display a message to the user saying the post has been deleted.</p>
<h2>Thank you</h2>
<p>Thanks for taking the time to read this tutorial. I hope that you have learnt something and that you keep returning to check out our latest tutorials.</p>
<p>If there is anything that you need help with then please post a comment and I'll write a tutorial on it or get back to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/2008/08/17/php-news-system-part-4/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
