<?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>FiddyP &#187; tutorial</title>
	<atom:link href="http://fiddyp.co.uk/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://fiddyp.co.uk</link>
	<description>The personal blog of Andy Bailey</description>
	<lastBuildDate>Sun, 13 May 2012 15:28:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>A course of course!</title>
		<link>http://fiddyp.co.uk/a-course-of-course/</link>
		<comments>http://fiddyp.co.uk/a-course-of-course/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 17:47:30 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[course]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/?p=1126</guid>
		<description><![CDATA[I&#8217;m working furiously behind the scenes at CommentLuv and haven&#8217;t been able to squeeze in any time for Fiddyp. For good reason though, I am working with another [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fa-course-of-course%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fa-course-of-course%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m working furiously behind the scenes at CommentLuv and haven&#8217;t been able to squeeze in any time for Fiddyp. <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
<img class="imgleft size-medium wp-image-1127" src="http://www.fiddyp.co.uk/wp-content/uploads/2008/12/mortar-board-pic-300x237.jpg" alt="" width="300" height="237" />For good reason though, I am working with another blog owner to produce a free email course called Blog From Scratch which, unlike other &#8220;how to blog&#8221; tutorials and series, will show you exactly what you need to know from the beginning of creating a blog to the methods used to promote it, populate it and of course, monetize it!</p>
<p>The first part is up and ready and the rest is being edited by me and will be up as soon as possible.</p>
<p>There will be an extra oomph to the whole thing though, that&#8217;s where it will get interesting! For now, know that it will offer something that no other site can give you and will be a significant benefit to you and your own readers. I&#8217;m not ready to say what it is yet but I honestly think it could be massive for the commentluv site!!</p>
<p>Have to go now and get the rest of the lessons online..</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/a-course-of-course/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Beginners AJAX Tutorial Series Part 5</title>
		<link>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-5/</link>
		<comments>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-5/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 11:17:11 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajaxseries]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-5/</guid>
		<description><![CDATA[This is part 5 of the AJAX Tutorial Series. You can see the other Beginners AJAX Tutorials here. Part 1 &#8211; An introduction to AJAX Part 2 &#8211; [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-5%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-5%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://fiddyp.co.uk/wp-content/uploads/2007/11/ajaxavenue.gif" alt="AJAX Avenue" /><br />
This is part 5 of the AJAX Tutorial Series.<br />
You can see the other Beginners AJAX Tutorials here.</p>
<ul>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/">Part 1 &#8211; An introduction to AJAX</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-part-2/">Part 2 &#8211; Hello world!</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-3">Part 3 &#8211; The Object of my desire</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-4">Part 4 &#8211; Are you ready?</a></li>
</ul>
<p>Hurrah! this tutorial will actually download some data (yey!) We will use everything we have learned so far and add just a little bit that will allow us to download data from the server and put it somewhere on the page without a refresh. (I know, you must have goosebumps!) <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>XMLHttpRequestObject.send(null);</h3>
<p>We need this command to initiate the object send. We created an object, created a place for the data to go, we created a routine to wait patiently for the object to be ready and sent the object to the data source using the above command. The patient routine for the waiting will take the response to the data source and put it in the div we created in the HTML of the page.</p>
<p>We can replace the bit from the last bit of complete code (on part 4) with this command and instead of it saying it&#8217;s ready to download, it will actually do the fetching for the <strong>obj.innerHTML=XMLHttpRequestObject.responseText;</strong> which is called when the readyState and Status are ok.</p>
<p>[HTML]</p>
<p>	  var XMLHttpRequestObject = false;<br />
	  if (window.XMLHttpRequest) {<br />
		XMLHttpRequestObject = new XMLHttpRequest();<br />
	  } else if (window.ActiveXObject) {<br />
		XMLHttpRequestObject = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />
	  }<br />
	  function getData(dataSource, divID)<br />
	  {<br />
		if(XMLHttpRequestObject) {<br />
		  var obj = document.getElementById(divID);<br />
		  XMLHttpRequestObject.open(&#8220;GET&#8221;, dataSource);<br />
		  XMLHttpRequestObject.onreadystatechange = function()<br />
		  {<br />
			if (XMLHttpRequestObject.readyState == 4 &amp;&amp;<br />
			  XMLHttpRequestObject.status == 200) {<br />
				obj.innerHTML=XMLHttpRequestObject.responseText;<br />
			}<br />
		  }<br />
	   XMLHttpRequestObject.send(null);<br />
		}<br />
	  }</p>
<h1>Fetching data with Ajax</h1>
<form></form>
<div id="targetDiv">
<p>The fetched data will go here.</p>
</p></div>
<p>[/HTML]</p>
<p>I&#8217;ll try and make this code easier to understand with a picture using pretty colours! <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
<a href='http://fiddyp.co.uk/wp-content/uploads/2008/01/part5picture.gif' title='Part 5 AJAX picture'><img src='http://fiddyp.co.uk/wp-content/uploads/2008/01/part5picture-150x150.gif' alt='Part 5 AJAX picture' /></a></p>
<p>The blue bit gets called when the user clicks the button, if the object was successfully created then create a routine that &#8216;listens&#8217; to the objects readyState and status. Then the <strong>XMLHttpRequestObject.send(null);</strong> command does the action and when that goes ahead and activates <strong>XMLHttpRequestObject.open(&#8220;GET&#8221;, dataSource);</strong> which goes off and gets the data pointed to by dataSource which of course changes the objects status and readyState. When it is at what we want, we inject the responseText to the div pointed to by divID.</p>
<p>Simple! :-/</p>
<p>You can see it in action <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part5/part5.html">here</a></p>
<p>Exciting huh? LOL . It&#8217;ll display anything that is in the oranges.txt file, not much use yet but at least we know we can fetch data!</p>
<p>What if, instead of displaying the contents of a text file, we used a php script to &#8216;echo&#8217; out something?.. replace oranges.txt with this code..</p>
<p>[PHP]<br />
echo &#8220;these are some oranges created by php!&#8221;;<br />
echo &#8220;<br />ooooooooooooooooooooooooooooooooo&#8221;;<br />
?&gt;<br />
[/PHP]</p>
<p>(don&#8217;t forget to enclose any php script with &lt;?php and ?&gt; or it wont work &#8211; I cant put them in here otherwise it will run the script instead of showing the code. Also, change the onclick event in the html to call oranges.php (if you saved the php with that name) instead of oranges.txt</p>
<p>You can see that in action <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part5/part5-2.html">here</a></p>
<p>There may be a pause between you clicking and the message being displayed. We can let the user know that something is happening by adding another <strong>if</strong> condition to look for a readyState of 1 (loading) and displaying the message &#8220;off to get oranges&#8230;&#8221; like this..</p>
<pre class="brush: xml; title: ; notranslate">
if (XMLHttpRequestObject.readyState == 1)
{
	obj.innerHTML=&quot;off to get oranges...&quot;;
}</pre>
<p>we just chuck that into the anonymous function that is called when the readyState changes&#8230;</p>
<pre class="brush: xml; title: ; notranslate">
XMLHttpRequestObject.onreadystatechange = function()
          {
            if (XMLHttpRequestObject.readyState == 4 &amp;amp;&amp;amp;
              XMLHttpRequestObject.status == 200) {
		obj.innerHTML=XMLHttpRequestObject.responseText;

            }
	    if (XMLHttpRequestObject.readyState == 1)
	    {
	 	obj.innerHTML=&quot;off to get oranges...&quot;;
	    }
          }
</pre>
<p>See that in action <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part5/part5-3.html">here</a></p>
<p>You can download all the files used in this tutorial <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part5/part5.zip">here</a>.</p>
<p>Now we&#8217;re getting somewhere! But, what if we want to send data to the php file so it can do something more than print a hardcoded message?<br />
Actually, it&#8217;s quite easy! come back next week to see the final part where we&#8217;ll send something to the php file and have it send back something it made with what we sent. (it could be a username or contents of a text field &#8211; think form validation!)</p>
<p>You can subscribe to my feed with the button at the top right of this blog or add your email to the box on the sidebar of the main page to subscribe by email. I hope you can come back and learn a bit more, enough at least to make your own php script and AJAX page&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-5/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>How to stop spam blogs from hotlinking your images with htaccess</title>
		<link>http://fiddyp.co.uk/prevent-hotlinking-images-with-htaccess/</link>
		<comments>http://fiddyp.co.uk/prevent-hotlinking-images-with-htaccess/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 12:11:11 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Blog Tools]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[hotlinking]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[protection]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/prevent-hotlinking-images-with-htaccess/</guid>
		<description><![CDATA[It&#8217;s a pain in the arse when someone copies your content, especially when they hotlink your images so your bandwidth gets used instead of their own so here&#8217;s [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fprevent-hotlinking-images-with-htaccess%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fprevent-hotlinking-images-with-htaccess%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>It&#8217;s a pain in the arse when someone copies your content, especially when they hotlink your images so your bandwidth gets used instead of their own so here&#8217;s a neat way of adding to your .htaccess file so you prevent particular blog networks from displaying images from your hosting by hotlinking them.<br />
Use this code:<br />
<code><br />
&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]<br />
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]<br />
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]<br />
RewriteRule .*\.(jpe?g|jpg|gif|bmp|png)$ http://www.commentluv.com/images/antihotlink.jpg [L]<br />
&lt;/IfModule&gt;</code></p>
<p>Just open up your .htaccess file (found in the root of your web space) and add the above lines. That should prevent blogs from myspace,blogspot and livejournal from hotlinking your images. You can add the url of a blog you know is hotlinking your images by following the format of the other RewriteCond statements.</p>
<p>Change the image url for the RewriteRule to one you have hosted somewhere (not on the same hosting because that will get redirected in a loop every time it is linked to).</p>
<p>It works pretty well, look at this screen shot of a self confessed content copier&#8230;.<br />
<img src='http://fiddyp.co.uk/wp-content/uploads/2007/12/antihotlinkexample.jpg' alt='Content Thief owned' /></p>
<p>There a couple of my posts on that blog and they are littered with images telling the (probably non existent) readers to come and read the article here instead. Another reason to always have an image in my articles!</p>
<p>It&#8217;s a shame there isn&#8217;t a way to do that with content though! If you are having trouble with spam blogs scraping your content and images, you can read a fantastic article here on <a href="https://lorelle.wordpress.com/2006/04/10/what-do-you-do-when-someone-steals-your-content/">what to do when someone steals your content</a> by Lorelle who has a treasure trove of WordPress and blogging information. Well worth a look!</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/prevent-hotlinking-images-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginners AJAX Tutorial Series Part 4</title>
		<link>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-4/</link>
		<comments>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-4/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 09:58:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[ajaxseries]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-4/</guid>
		<description><![CDATA[This is part 4 of the AJAX Tutorial Series. You can see the other Beginners AJAX Tutorials here. Part 1 &#8211; An introduction to AJAX Part 2 &#8211; [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-4%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/11/ajaxavenue.gif' alt='Ajax Avenue Street Sign' /><br />
This is part 4 of the AJAX Tutorial Series.<br />
You can see the other Beginners AJAX Tutorials here.</p>
<ul>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/">Part 1 &#8211; An introduction to AJAX</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-part-2/">Part 2 &#8211; Hello world!</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-3">Part 3 &#8211; The Object of my desire</a></li>
</ul>
<p>In this part of the tutorial series we will get ready to <del>rumble!</del> download data using the object we created in the last part&#8230;</p>
<h3>onreadystatechange</h3>
<p>What the hell is that? lol, it&#8217;s not move states when you&#8217;re ready.. it&#8217;s what we use on the object we created to see what state it is in, the different states are:</p>
<ul>
<li>0 &#8211; Uninitialized</li>
<li>1 &#8211; Loading</li>
<li>2 &#8211; Loaded</li>
<li>3 &#8211; Interactive</li>
<li>4 &#8211; Complete</li>
</ul>
<p>We can check for an objects state to see where it&#8217;s at to decide if we can output the result or not, we can combine this with a test for the HTTP status of a download to see if it was successful, we can check for a value of 200 which means everything went ok. (a value of 404 would mean file not found just like normal HTTP status codes).</p>
<p>To use the readystate property, just bang it on the end of the object name and put that in an &#8216;if&#8217; statement. Ie&#8230;</p>
<p><code>if (XMLHttpRequestObject.readyState == 4 &amp;&amp; XMLHttpRequestObject.status == 200)<br />
{do something}</code></p>
<p>(the &amp;&amp; means AND, so we check the readystate AND the status, if they are BOTH correct then execute the code in the curly brackets)</p>
<p>To put that in the code of the last tutorial, replace the bit that outputs the message about the oranges box being collected with an anonymous function that is attached to the objects readystate. It&#8217;s not named an anonymous function because it has a secret identity, it is just a nice way of running a function with no name when a certain thing happens like the objects&#8217; readystate being changed.</p>
<p>For example, if we put<br />
<code>XMLHttpReqestObject.onreadystatechange = function()<br />
{<br />
do something<br />
}<br />
</code></p>
<p>We have attached the onreadystatechange to the object we created, as soon as that objects readystate has altered, the anonymous function takes action and executes the commands contained in the curly brackets ({do something }).</p>
<p>That&#8217;s exactly where we put the test to see what the HTTP status and readystate number is. Ie.</p>
<p><code>XMLHttpRequestObject.onreadystatechange = function()<br />
          {<br />
            if (XMLHttpRequestObject.readyState == 4 &amp;&amp; XMLHttpRequestObject.status == 200)<br />
             {<br />
              data downloaded, do something with it...<br />
             }<br />
          } </code></p>
<p>You may have noticed little graphics that are synonymous with web 2.0 and AJAX ( <img src='http://fiddyp.co.uk/wp-content/uploads/2007/12/ajaxloading.gif' alt='ajax loading' /> ). You can add one of those to let the user see something is happening. In the code above, you can check for a readyState of 1 (loading) and add some text like this:</p>
<p><code>XMLHttpRequestObject.onreadystatechange = function()<br />
          {<br />
            if (XMLHttpRequestObject.readyState == 1)<br />
             {<br />
              obj.innerHtml="Loading...";<br />
             }</p>
<p>            if (XMLHttpRequestObject.readyState == 4 &amp;&amp; XMLHttpRequestObject.status == 200)<br />
             {<br />
              data downloaded, do something with it...<br />
             }<br />
          } </code></p>
<p><em>The FiddyP amazing analogy:</em><br />
Last time we had created a box for the oranges that we want from the AJAX shop<br />
<code>XMLHttpRequestObject = new XMLHttpRequest();</code><br />
then we opened it and sent  it to the AJAX shop with a label of what we want.<br />
<code>XMLHttpRequestObject.open("GET", dataSource);</code><br />
And we wait for the signal that the box we sent was filled ok and ready to go<br />
<code>if (XMLHttpRequestObject.readyState == 4 &amp;&amp; XMLHttpRequestObject.status == 200)</code></p>
<p>Your whole code will now look like this&#8230;</p>
<pre class="brush: xml; title: ; notranslate">

    &lt;title&gt;FiddyP AJAX Tutorial Series Part 4&lt;/title&gt;

      var XMLHttpRequestObject = false;
      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
      }
      function getData(dataSource, divID)
      {
        if(XMLHttpRequestObject) {
          var obj = document.getElementById(divID);
          XMLHttpRequestObject.open(&quot;GET&quot;, dataSource);

          XMLHttpRequestObject.onreadystatechange = function()
          {
            if (XMLHttpRequestObject.readyState == 4 &amp;amp;&amp;amp;
              XMLHttpRequestObject.status == 200) {
            }
          }
	   obj.innerHTML = &quot;Ready to download&quot;;

        }
      }

    &lt;h1&gt;Fetching data with Ajax&lt;/h1&gt;
    &lt;form&gt;

    &lt;/form&gt;
    &lt;div id=&quot;targetDiv&quot;&gt;
      &lt;p&gt;The fetched data will go here.&lt;/p&gt;
    &lt;/div&gt;
</pre>
<p>OK, so you have your box at the AJAX shop full of oranges.txt, next tutorial we&#8217;ll do something with the oranges&#8230;</p>
<p>If you&#8217;ve been following the other tutorials then the code above shouldn&#8217;t be so hard to understand (shyeah right!), it&#8217;s just a bit more added to what we&#8217;ve already covered. You can copy the code from above and try it out yourself or you can click <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part4/getReady.html">here</a> to see it in action (hold on to your hat <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> )</p>
<p>We&#8217;re still in the AJAX starting blocks waiting for the bang to start us on the AJAX runway but don&#8217;t despair, next tutorial we will actually download data from a server and display it on the page without a reload which is what AJAX is all about. Once we can actually display the data, we can start doing things with it and then we can start to make pretty little scripts that do amazing things like count the amount of times a pink box has been clicked. hehehe, we&#8217;ll do more than that I promise!</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginners AJAX Tutorial Series Part 3</title>
		<link>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-3/</link>
		<comments>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-3/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 15:37:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[ajaxseries]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-3/</guid>
		<description><![CDATA[This is part 3 of the AJAX Tutorial Series. You can see the other Beginners AJAX Tutorials here. Part 1 &#8211; An introduction to AJAX Part 2 &#8211; [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-3%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/11/ajaxavenue.gif' alt='Ajax Avenue Street Sign' /><br />
This is part 3 of the AJAX Tutorial Series.<br />
You can see the other Beginners AJAX Tutorials here.</p>
<ul>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/">Part 1 &#8211; An introduction to AJAX</a></li>
<li><a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-part-2/">Part 2 &#8211; Hello world!</a></li>
</ul>
<p>In this part of the tutorial series we will open the object that you created in the last tutorial. So far, we have created an object to handle the data and made sure it is created in whatever browser you are using. Now, if we want to work with the created object, we need to open it&#8230;</p>
<h3>Open The XMLHttpRequest Object</h3>
<p>Opening the object prepares it for use to fetch the data from a server, the act of opening the object doesn&#8217;t actually fetch any data yet.</p>
<p><em>The FiddyP amazing analogy</em> :- Imagine you created a page to collect a box of oranges from the local AJAX fruit shop. In the last tutorial, you created the box (object), now you need to open it so the AJAX oranges can fit inside&#8230;</p>
<p>The open comand: [square brackets] = optional arguments.</p>
<p><code>open("method", "url" [, asyncFlag[, "username"[, "password"]]])</code></p>
<p>Explanation:</p>
<ul>
<li><strong>method</strong> is the HTTP method to use when opening the connection. It can be &#8216;GET&#8217;, &#8216;POST&#8217;, &#8216;PUT&#8217; or &#8216;HEAD&#8217;</li>
<li><strong>url</strong> is the URL you want to download from</li>
<li><strong>asyncFlag</strong> is a Boolean (one or the other) value used to indicate that the call is asynchronous. (no waiting for it to finish)<br />
This defaults to TRUE or 1 so is not needed unless you want to specify that the page waits for completion.</li>
<li><strong>username</strong> is if you need a username to access the page identified by URL</li>
<li><strong>password</strong> is for a password if it&#8217;s required.</li>
</ul>
<p>Make sense? lol, maybe not. Here&#8217;s how it looks in use:</p>
<p><code>XMLHttpRequestObject.open("GET","oranges.txt");</code></p>
<p>We just add the <em>open</em> bit of code on to the end of the name of the object we created. Here&#8217;s an example page where we create a form in HTML and add a button for the user to click to open a remote file on the server with AJAX. Because AJAX uses CSS to change elements of the page, we need to create a &lt;div&gt; on the page to show the data we retrieve from the remote file. We&#8217;ll also have to create a function to take action when the button is clicked (we can&#8217;t do it the normal way with the &lt;form&gt; action because that would cause the page to reload).</p>
<p>Here&#8217;s the form and div html:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form&gt;

&lt;/form&gt;

&lt;div id=&quot;targetDiv&quot;&gt;
  &lt;p&gt;The oranges box will go here.&lt;/p&gt;
&lt;/div&gt; </pre>
<p>You can see that the button has an &#8216;onclick&#8217; event. That&#8217;s the javascript bit that calls the function when the button is clicked. The &lt;div&gt; has an id so the function will know where to put the collected data.</p>
<p>The javascript function is held in the &lt;head&gt; part of the document;</p>
<pre class="brush: jscript; title: ; notranslate">function getData(dataSource, divID)
      {
        if(XMLHttpRequestObject) {
          var obj = document.getElementById(divID);
          XMLHttpRequestObject.open(&quot;GET&quot;, dataSource);

          obj.innerHTML=&quot;Oranges Box Opened!&quot;;
        }
      }</pre>
<p>The function is called with the name of the data file we want (dataSource) and where to put the output (divID)<br />
The first line checks if the XMLHttpRequestObject was created (we did that last time so you know it should get to this point)<br />
If it finds that the object was created, it moves on to set the variable <strong>obj</strong> to the &lt;div&gt; we created by using <em>getElementByID</em><br />
Next, we use the open command on the object we created earlier, set the option to GET and point it to the external data file we specified when calling the function.<br />
Once that is done, we can output a message to the &lt;div&gt; we assigned to the variable <strong>obj</strong> by using <em>.innerHTML=</em></p>
<p>We&#8217;ll just put this function in place of the &#8220;hello world&#8221; message that we put in the last tutorial..</p>
<p>The whole code looks like this&#8230;</p>
<pre class="brush: xml; title: ; notranslate">

    &lt;title&gt;FiddyP AJAX tutorial, open the object&lt;/title&gt;

      var XMLHttpRequestObject = false;
      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
      }

      function getData(dataSource, divID)
      {
        if(XMLHttpRequestObject) {
          var obj = document.getElementById(divID);
          XMLHttpRequestObject.open(&quot;GET&quot;, dataSource);
          obj.innerHTML=&quot;Oranges Box Opened!&quot;;
        }
      }

    &lt;h1&gt;Fetching data with Ajax&lt;/h1&gt;
    &lt;form&gt;

    &lt;/form&gt;
    &lt;div id=&quot;targetDiv&quot;&gt;
      &lt;p&gt;The Oranges box will go here.&lt;/p&gt;
    &lt;/div&gt;
</pre>
<p>You can copy the contents of the HTML shown above and save it as a HTML file, you can also create a file called <strong>oranges.txt</strong> and put it in the same directory as the HTML file. (it doesn&#8217;t matter what is in the text file as we wont be doing anything with it other than to open it). Open the HTML file in your browser and try it yourself or click <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/part3/oranges.htm">here</a> to see it in action if you can&#8217;t wait.</p>
<p>That&#8217;s it for this week, we&#8217;re still not doing anything major yet but, be happy! we have so far, created an object and opened it. YEY! come back for part 4 where we will prepare to download information from the file we opened. (oh, I bet you can&#8217;t wait!!)</p>
<p>beep beep w00t!</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginners AJAX Tutorial Part 2</title>
		<link>http://fiddyp.co.uk/beginners-ajax-tutorial-part-2/</link>
		<comments>http://fiddyp.co.uk/beginners-ajax-tutorial-part-2/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 12:09:16 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[ajaxseries]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/beginners-ajax-tutorial-part-2/</guid>
		<description><![CDATA[This is part 2 of the AJAX Tutorial Series. You can see the Beginners AJAX Tutorial Part 1 here. In this part, we will start you off with [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-part-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-part-2%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/11/ajaxavenue.gif' alt='Ajax Avenue Street Sign' /><br />
<em>This is part 2 of the AJAX Tutorial Series. You can see the <a href="http://www.fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/">Beginners AJAX Tutorial Part 1 here</a>.</em></p>
<p>In this part, we will start you off with some very simple code just to show you how things get started. At the end of this tutorial you will have made your own &#8216;hello world&#8217; AJAX script&#8230; (not a big deal I know, but you have to start somewhere!). I&#8217;ll keep these tutorials bitesize and introduce a new command or concept on each tutorial to add to what has already been covered. Today, we start at the beginning with something that will be in all future scripts&#8230;</p>
<h3>The XMLHttpRequest Object</h3>
<p>The what? <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
The XMLHttpRequest object is at the heart of AJAX. It allows you to send and receive data with javascript without refreshing the page and works on all browsers (except, you guessed it! Internet Explorer). All you have to do is find out if the browser supports it with an &#8216;if&#8217; statement in the javascript contained in the &lt;head&gt; part of the html page and then create a XMLHttpRequest object using the &#8216;new&#8217; command;</p>
<pre class="brush: jscript; title: ; notranslate">if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();}</pre>
<p>That would create a XMLHttpRequest object and store it in XMLHttpRequestObject.</p>
<p>But, what about Internet Explorer?.. We can&#8217;t use XMLHttpRequest so we have to use an ActiveXObject. For us to do anything with an XMLHttpRequest  and make sure it works on both IE and Firefox, we can add this to the javascript so we now have..</p>
<pre class="brush: jscript; title: ; notranslate">if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
      }</pre>
<p>OK, that should cover us for making a XMLHttpRequest object, we can&#8217;t do anything in this tutorial series without it so to be sure, lets just create the whole html document and test to see if it can make an object by adding another &#8216;if&#8217; statement to output some text to the screen if the object creation was successful using the javascript command &#8216;document.write()&#8217;.</p>
<pre class="brush: xml; title: ; notranslate">

    &lt;title&gt;FiddyP Ajax Tutorial Part 2 - Test object creation&lt;/title&gt;

      var XMLHttpRequestObject = false;

      if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        XMLHttpRequestObject = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
      }

      if (XMLHttpRequestObject) {
        document.write(&quot;&lt;h1&gt;Hello World! I Created an Object!&lt;/h1&gt;&quot;);
      }
</pre>
<p>You can click on the title of the code snippet above and see the plain text version, just copy this to your own file and save it as an HTML document or right click <a href="http://www.fiddyp.co.uk/internal/ajax_tutorials/FiddyP_AJAX_part2/createObject.html">here </a>and save it and test it. If it&#8217;s working, it will display the message &#8220;hello world! I created an object!&#8221; in big letters.</p>
<p>YEY! we created a &#8216;hello world&#8217; AJAX program!, I know it&#8217;s not much use yet but this is the foundation for all future tutorials so even thought it&#8217;s not that &#8216;sexy&#8217; , it IS important to make sure we can create the object that will handle the data being sent to and received from a remote file.</p>
<p>We can get into the sexy ins and outs of using this on the next tutorial. Please come back again to see how we can use this to open a remote file and display it&#8217;s contents on a HTML page without a reload&#8230;(ooh, I can&#8217;t wait&#8230;.)<br />
 <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/beginners-ajax-tutorial-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginners AJAX. Tutorial series. Part 1</title>
		<link>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/</link>
		<comments>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 10:33:19 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[ajaxseries]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/ajax-tutorial-series-part-1/</guid>
		<description><![CDATA[This is the first in a series of tutorials about AJAX and how to use it on your site. Each new tutorial will take the subject a little [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-1%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fbeginners-ajax-tutorial-series-part-1%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/11/ajaxavenue1.gif' alt='Ajax Avenue Street Sign' /><br />
This is the first in a series of tutorials about AJAX and how to use it on your site. Each new tutorial will take the subject a little bit further and hopefully, it wont be long before you start creating your own AJAX applications for your own site and revel in the wonderness of geekdom <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>It seems more and more people want to use this type of programming method to bling their blog up to 2.0 level including me!, so come along as I traverse the wonders of AJAX. I am learning this as I go so it&#8217;s not really fair to call it a tutorial series but you get the idea!</p>
<p>First off, we need to know what AJAX is&#8230;</p>
<h3>Part 1.<br />
AJAX Introduction.</h3>
<p>The first thing to know about AJAX is that in fact, it isn&#8217;t actually a programming language. It&#8217;s just a way of using other languages together to create an &#8216;application&#8217; style of interface for a web page.</p>
<p>The word &#8216;AJAX&#8217; comes from a contraction of &#8216;Asynchronous&#8217;, &#8216;Javascript&#8217;, &#8216;And&#8217;, &#8216;XML&#8217;, it&#8217;s purpose is to allow a web page to send and receive small bits of data &#8216;asynchronously&#8217; while the user is still on the page and change the contents of parts of the page with the data received.</p>
<p>It could be something simple like automatically updating a shipping charge after a customer enters their postal code in a form or it could be something more familiar like the Google auto-guess/complete that happens when you start typing in a search term.<br />
<img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/googlelabs.gif' alt='Google labs auto guess' /><br />
As soon as you start typing something in the search box, the javascript on the page detects each key press and sends it to the server which then sends back any terms that have the same letters starting the term, as you continue to type it shows a narrowing set of options and how many results they each have. You can try it out yourself at <a href="http://labs.google.com/suggest">http://labs.google.com/suggest</a></p>
<p>Here are some other examples of sites using AJAX.</p>
<ul>
<li><a href="http://maps.google.com/">Google Maps</a></li>
<li><a href="http://www.flickr.com/">Flickr</a></li>
<li><a href="http://wwwm.meebo.com/">Meebo</a></li>
</ul>
<p>The important thing to remember is that AJAX is the term used when the page needs to send and/or receive data to the server asynchronously, whereas a sliding DIV or a dynamic menu is just Javascript or DHTML.</p>
<hr />
<h3>The difference between normal and AJAX web applications</h3>
<p><strong>A traditional web application</strong>(using a shopping cart form example)<br />
<img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/traditionalserver.gif' alt='Traditional web application diagram' /><br />
.. a user enters their shipping details and clicks submit, the page sends the form details and reloads again showing the shipping charge.</p>
<p><strong>AJAX web application</strong><br />
<img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/ajaxapplication.gif' alt='Ajax web application diagram' /><br />
.. a user enters their postal code and the server automatically calculates the shipping charge and returns it to the original page, all without the user having to wait for another page load. Much more efficient!</p>
<hr />
<h3>How does it do it?</h3>
<p>It&#8217;s the work of the devil! that&#8217;s how! <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Seriously though, javascript, css and html are used on the browser side and a scripting language is used on the server. The scripting language can be PHP, perl, asp or any kind of get-process-return language that runs on a server.</p>
<p>Really, javascript is the boss for all the actions as it is responsible for orchestrating everything on the client side. ie:<br />
The javascript detects the click, text entry or other action which initiates a call to the script on the server which responds with the data requested, the javascript receives the data and by using css and html it is able to update the page, all without the user having to wait for a page load as with traditional web pages.</p>
<p>Take a look at this diagram:<br />
<img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/ajaxprocess.gif' alt='AJAX process' /></p>
<ol>
<li>The javascript detects an event and requests information from the server</li>
<li>The server accepts the request, processes it and returns it&#8217;s own data</li>
<li>The javascript accepts the data and uses CSS and HTML to put it on the page</li>
</ol>
<hr />
<h3>Data types</h3>
<p>Probably the best data type used is XML, simply because it is a standard capable of representing complex data that would otherwise be difficult to represent. But, that doesn&#8217;t mean that XML is the only type of data that can be used. You could use plain text if there was only a small amount of simple data to be sent like a name or value.</p>
<p>You could also use something called JSON (JavaScript Object Notation) but that&#8217;s for a later tutorial (and for geekier types!)</p>
<hr />
<h3>The Server role</h3>
<p>It&#8217;s important to remember that AJAX is entirely dependent on a server program accepting requests and responding to them in some way. You can&#8217;t just make a web page with some Javascript on it and have an AJAX application, you need the javascript to send and receive information and do something with it.</p>
<p>You don&#8217;t have to use the same server as the web page to do the processing, you could just as easily use a script on a remote server.<br />
Places like Google, Flickr and others allow people to use an API (Application Programming Interface) to request information from one of their scripts on their server. Flickr for example could send back information listing a users photo locations so the AJAX page could display them.</p>
<p>Simply, whatever the server or javascript does, it all comes down to ; request send, request received, data processed, data sent back, data used.</p>
<hr />
Ok! that&#8217;s the introduction dealt with, I hope that clears up exactly what AJAX is for you!</p>
<p>On the next part of this series, we will get into the guts of an AJAX application and show you just how it works and how you can change it yourself. For now, here is an example of what you should be able to do after a couple more tutorials..</p>
<p>It detects a click on the pink area and sends a request to a PHP script that reads a text file containing a number, adds one to it, saves it and sends back the number to be displayed on the page. Try it yourself, it may take a couple of seconds to show the number (this is just an example, later we will add a nice AJAX&#8217;y type of wait animation). I wonder how high this number will/can go? <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div>
<b>Practical Example</b></p>
<ul>
<li><span>Click Me!</span> <em>clicks so far</em> : <span></span></li>
</ul>
</div>
<p>Come back next week for the second part of the series where we will get into the innards of AJAX and show you just whats needed to make the traditional &#8216;hello world&#8217; program&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/beginners-ajax-tutorial-series-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add a shopping cart to WordPress</title>
		<link>http://fiddyp.co.uk/how-to-add-a-shopping-cart-to-wordpress/</link>
		<comments>http://fiddyp.co.uk/how-to-add-a-shopping-cart-to-wordpress/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 13:45:29 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Business Software]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[Making / Made Money]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[shopping cart]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/how-to-add-a-shopping-cart-to-wordpress/</guid>
		<description><![CDATA[Here&#8217;s a great way to add a shopping cart to your WordPress blog so you can sell products directly from your site without the user having to go [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fhow-to-add-a-shopping-cart-to-wordpress%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fhow-to-add-a-shopping-cart-to-wordpress%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/shoppingcart.gif' alt='Shopping cart' align="left" hspace="8">Here&#8217;s a great way to add a shopping cart to your WordPress blog so you can sell products directly from your site without the user having to go to an external site. If you offer products for sale on your blog, it&#8217;s much nicer for your customers to stay on the same site that they see the products on.</p>
<p>This plugin is simple and powerful, it uses AJAX for some parts of it and it seems to work just dandily on the blog I have installed it on. Here&#8217;s how you do it&#8230;</p>
<p>[expert instructions]<br />
Download plugin, upload to plugins directory, activate it.<br />
Visit the ecommerce tab and set options for country and currency, edit categories, edit checkout options, edit gateway options, add products.<br />
sell!<br />
[/ expert instructions]</p>
<p>[Hand hold instructions]<br />
First, get yourself a copy of the <a href="http://www.instinct.co.nz/e-commerce" title="WP shopping cart" target="_blank">WP Shopping Cart plugin</a> and upload it to your plugins directory, go to you plugins page and activate it :</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/pluginspage.gif" title="wp shopping cart plugin activate"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/pluginspage.thumbnail.gif" alt="wp shopping cart plugin activate" /></a><br />
<span id="more-138"></span><br />
You should see a new tab at the top of the dashboard labeled &#8216;ecommerce&#8217; . Click that and we can set up the options for our country and tax rate. Just select your country from the pull down box and it should set the tax rate for you.</p>
<p>You can also require someone to be registered before they can purchase products. This is up to you, for now, you can leave it as &#8216;no&#8217;. The only problem with requiring a user to register first is the non-immediate way in which WordPress allocates a password to a user by emailing it to them. Also, once someone logs in to your site, they get presented with the dashboard and not the site but there&#8217;s a great plugin to use to beat that <a href="http://www.jameskelly.org/wordpress-plugins/custom-login-and-registration-forms-plugin/">here</a>.</p>
<p>Leave the URL settins for now, they&#8217;ll work just find and dandy as they are (they may look different on your setup if you have a different permalink structure)</p>
<p>Choose your language and keep the theme as default:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions.gif" title="shop options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions.thumbnail.gif" alt="shop options" /></a></p>
<p>Next, you need to choose your cart location. I use the setting as a widget because this blog is widget enabled. You can choose to add it manually yourself by inserting the code to anywhere on your sidebar if widgets aren&#8217;t your thing.</p>
<p>Choose which options you want and be sure to choose the correct currency setting for your country:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions2.gif" title="shop options2"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions2.thumbnail.gif" alt="shop options2" /></a></p>
<p>The next section asks you if you want to charge shipping, if you are selling physical products then you need to choose &#8216;yes&#8217; and set the base shipping charges. (base charges are standard and only added once regardless of how many products are added to the cart, you can add additional delivery charges on the product settings) :</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions3.gif" title="shop options3"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/shopoptions3.thumbnail.gif" alt="shop options3" /></a></p>
<p>Click &#8216;submit&#8217; and that&#8217;s one page done!</p>
<hr /> Now to edit category and products&#8230;Click on the &#8216;categories&#8217; tab for ecommerce and then on &#8216;edit&#8217; next to the example category and put in your own options and click &#8216;edit category&#8217; when you are done:<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/categoryoptions.gif" title="Category options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/categoryoptions.thumbnail.gif" alt="Category options" /></a></p>
<hr /> Now, add your products!<br />
Click on the &#8216;products&#8217; tab and choose the category you want to add products to from the pull down box. Just add the options you want..Product Name:<br />
Description:<br />
Additional Description:<br />
Choose the categories for the product by ticking the boxes for each category:<br />
Choose a brand if you are using one:<br />
Enter the price of the product you are selling:<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productoptions.gif" title="Product Options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productoptions.thumbnail.gif" alt="Product Options" /></a></p>
<p>The next option is stock control, if you are selling physical products then you can tick the box for &#8216;limited items&#8217; and it will give you a field for putting how many items of this you have, once you run out the software wont show this product any more until you get more stock and edit the amount here.</p>
<p>Variation control is a way to add options to a product, like size for a t-shirt or a colour choice which will be selectable on the product description page before a customer adds the product to the shopping cart.</p>
<p>Additional shipping costs can be added so that each item that is added to the cart will also add that amount to the shipping (good for heavy items)</p>
<p>Product images are self explanatory and always a good idea to use a decent picture for your product, the plugin does a good job of creating a thumbnail and uses AJAX to display the full size image when a customer clicks it. (choose your thumbnail size or upload a seperate thumbnail if you want)</p>
<p>Product download is for digital items.</p>
<p>Click &#8216;add product&#8217; to save your product settings:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productoptions2.gif" title="Product Options2"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productoptions2.thumbnail.gif" alt="Product Options2" /></a></p>
<p>If you don&#8217;t want tax added to each item or it is already included in the price then select the option to &#8216;do not include tax&#8217;.</p>
<hr /> Payment options. You need some way to allow payments right? this shopping cart only gives you the option to receive money by Paypal, the customer can use their paypal balance or a credit card to purchase your products and the money will be received into your paypal account.First, go to the &#8216;payment gateway&#8217; tab and select &#8216;paypal&#8217; from the pull down box, you&#8217;ll presented with a screen to add your details.Enter your paypal email address:<br />
Paypal IPN  is the paypal instant payment notification, if you&#8217;re selling physical products then you probably wont need this.<br />
Paypal accepted currency is what your paypal account is set up for.<br />
Forms: just use the pull down boxes to select the correct fields for each title (use the top set of options on the pull down boxes):<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/gatewayoptions.gif" title="Gateway options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/gatewayoptions.thumbnail.gif" alt="Gateway options" /></a></p>
<hr /> Checkout options: This is the last screen you have to edit, the default is set to ask the customer to input their cardholder address and shipping address but I think it&#8217;s better to just use the cardholder address (for anti-fraud purposes).To remove the shipping details fields, just click the trash can icon on the side of each field to remove it, you can add other fields too like a text area for added delivery instructions etc. I make sure that the &#8216;mandatory&#8217; option is selected for the postal code too.Choose the option for &#8216;paypal/credit card only&#8217; if you don&#8217;t plan on letting your customers pay manually by check or other option:<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/checkoutoptions.gif" title="Checkout options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/checkoutoptions.thumbnail.gif" alt="Checkout options" /></a></p>
<hr /> That&#8217;s the settings done, now we have to add the widget and perhaps don&#8217;t display certain pages that were added by the plugin to your tabs or &#8216;pages&#8217; list..You can add the shopping cart by visiting &#8216;presentation/widgets&#8217; and dragging the cart button to wherever you want:<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/widgetoptions.gif" title="Widget options"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/widgetoptions.thumbnail.gif" alt="Widget options" /></a>If you have noticed the extra pages being displayed on your blog and you don&#8217;t want them, simply change the template code for the page list display options. You will need to know the post id of each of these pages so click on &#8216;manage/pages&#8217; to see a list and note down their respective id&#8217;s and use an &#8216;exclude&#8217; option in your template wherever there is a &#8216;wp_list_pages&#8217; function. eg:</p>
<pre class="brush: php; title: ; notranslate">wp_list_pages('exclude=4,5,6' ); </pre>
<hr />That&#8217;s it! you should now have a products page showing your products and when someone clicks &#8216;add to cart&#8217; , it will AJAX it over to the shopping cart ready to be checked out:<br />
<a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productadded.gif" title="product added"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/productadded.thumbnail.gif" alt="product added" /></a></p>
<p>Once &#8216;checkout&#8217; is pressed, the customer is presented with the screen to add their address details:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/checkoutpage.gif" title="Checkout"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/checkoutpage.thumbnail.gif" alt="Checkout" /></a></p>
<p>Once that is filled in, they click &#8216;make purchase&#8217; and will be sent to the paypal login page where they can use their paypal account or pay by credit card if they don&#8217;t have an account already:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/paypalscreen.gif" title="paypal screen"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/paypalscreen.thumbnail.gif" alt="paypal screen" /></a></p>
<p>You will be able to see a record of what purchases have been made on the first tab of the &#8216;ecommerce&#8217; section:</p>
<p><a href="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/purchaselog.gif" title="Purchase log"><img src="http://www.fiddyp.co.uk/wp-content/uploads/2007/10/purchaselog.thumbnail.gif" alt="Purchase log" /></a></p>
<hr />There you go! This is just a quick and dirty way to get a shopping cart on your blog, you can play around with lots of options to your hearts content if you have many products or want to offer digital downloads. There&#8217;s even a widget to add a donation button to your blog and have that go in the shopping cart.Personally, I like this way of selling on your blog and have used this (edited) plugin on a commissioned site using a very simple (and very edited) WordPress 2.3 theme, the customer loved it!</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/how-to-add-a-shopping-cart-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>easy ecommerce, AJAX and professional designs</title>
		<link>http://fiddyp.co.uk/easy-ecommerce-ajax-and-professional-designs/</link>
		<comments>http://fiddyp.co.uk/easy-ecommerce-ajax-and-professional-designs/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 08:55:47 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Blog News]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/easy-ecommerce-ajax-and-professional-designs/</guid>
		<description><![CDATA[Wow! what a busy week I have just had, I have barely been able to keep up with comments here and I&#8217;ve sorely neglected my blogging brethren by [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Feasy-ecommerce-ajax-and-professional-designs%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Feasy-ecommerce-ajax-and-professional-designs%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src='http://fiddyp.co.uk/wp-content/uploads/2007/10/shoppingcart.gif' alt='Shopping cart' align="left" hspace="8">Wow! what a busy week I have just had, I have barely been able to keep up with comments here and I&#8217;ve sorely neglected my blogging brethren by not popping in for a cup of tea, sorry about that everyone but I&#8217;ve been busy with some commercial projects for work which turned out to be great fun!</p>
<p>I have been working on some ecommerce sites and CMS scripts to get a &#8216;proof of concept&#8217; site up for a client and it went really well, one of the proofs turned out so well that I think it may become the one that we use! (that&#8217;ll save some time when it comes to launch day!)</p>
<p>Part of the ecommerce research I did to see what would work led me to trying lots of different things, one of them being a simple wordpress theme with an added shopping cart which turned out to be a very simple and cheap solution. It worked really well and was up and running in a couple of hours so that got me thinking about writing a series of posts later explaining how to sell products direct from your blog with the minimum amount of fuss.</p>
<p><a href="http://amazon.co.uk/s/ref=nb_ss_w_h_/203-4387211-1646344?initialSearch=1&amp;url=search-alias%3Daps&amp;field-keywords=ajax+construction+kit&amp;Go.x=0&amp;Go.y=0&amp;Go=Go"><img src="http://ecx.images-amazon.com/images/I/21vaPOsBg7L._AA115_.jpg" alt="AJAX Construciton kit" align="left" hspace="8"></a>I also bought a book about AJAX called &#8220;The AJAX construction kit&#8221;. I bought it after browsing through it&#8217;s pages in the local book shop, a nice place where you can sit down and read through any of the books on display before you buy&#8230;. or do as I do and use the free wifi provided to get my PDA online and type in the ISBN number on Amazon and then order it for 1/3 of the price of the shop! (teehee)</p>
<p>So far it&#8217;s been a great read and I particularly like the way it teaches you how to do things with the construction kit rather than try and teach you every single nut and bolt of Javascript and PHP. It&#8217;s a much better way to learn how to get AJAX scripts running on your site and I can see some very useful plugins coming this way when I&#8217;ve finished the book. In fact, a way to get me to read more will be to share what I learn with a series of AJAX tutorials here!</p>
<p>I am also considering getting a professional redesign done for here, I think a few hundred dollars will get me a fine looking site. I&#8217;m not even sure what I want yet and I had to abandon my idea of doing it all myself since the new work projects came in. Anyone out there use a professional designer and could recommend them?</p>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/easy-ecommerce-ajax-and-professional-designs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a WordPress plugin with less than 20 lines of code</title>
		<link>http://fiddyp.co.uk/how-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code/</link>
		<comments>http://fiddyp.co.uk/how-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code/#comments</comments>
		<pubDate>Fri, 07 Sep 2007 11:05:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[HelloStumbler]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[profit]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.fiddyp.co.uk/2007/09/07/how-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code/</guid>
		<description><![CDATA[I had a truckload of hits come to this site last night for my Hello Stumbler plugin, so I thought I would share with you how to make [..]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Ffiddyp.co.uk%2Fhow-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Ffiddyp.co.uk%2Fhow-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code%2F&amp;source=commentluv&amp;style=normal&amp;service=bit.ly&amp;service_api=R_259b4e5679e2c431cca1f989e158bba4&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I had a truckload of hits come to this site last night for my <a href="http://www.fiddyp.co.uk/2007/09/06/hello-stumbler-wordpress-plugin-for-stumbleupon-visitors/">Hello Stumbler</a> plugin, so I thought I would share with you how to make a plugin so you can publish it, stumble it, digg it and bask in your coding glory as it generates hits to your site!</p>
<p>If you&#8217;re interested in making your own plugins you should read a book called <a class="easyazon-link"   href="http://www.amazon.com/dp/0470916222?tag=commentluv-20&linkCode=as2">Professional WordPress Plugin Development</a> to learn how to do it yourself</p>
<p><a title="hello stumbler code" href="http://fiddyp.co.uk/wp-content/uploads/2007/09/hellostumblercode.jpg"><img src="http://fiddyp.co.uk/wp-content/uploads/2007/09/hellostumblercode-150x150.jpg" alt="hello stumbler code" /></a></p>
<p><span id="more-44"></span><br />
I&#8217;ll use my Hello Stumbler plugin as a guide&#8230;(now re-done so you can see the code all proper like)</p>
<p>here&#8217;s the whole code</p>
<pre class="brush: php; title: ; notranslate">

/*
Plugin Name: Hello Stumbler
Version: 1.1
Plugin URI: http://www.fiddyp.co.uk/2007/09/06/hello-stumbler-wordpress-plugin-for-stumbleupon-visitors/
Author: Andy Bailey
Author URI: http://www.fiddyp.co.uk
Description: Adds a message to request a thumbs up if post is seen via Stumbleupon. Just place hellostumbler(); in your single post template
*/

function hellostumbler(){
	global $id;
	$refer=$_SERVER['HTTP_REFERER'];
	$title=the_title('','',false);
	if ($refer==&quot;http://www.stumbleupon.com/refer.php&quot; &amp;amp;&amp;amp; is_single()) {
		echo &quot;&lt;strong&gt; Thanks for Stumble-ing here!&lt;br /&gt;Please give me a &lt;a&gt;&lt;img&gt;thumbs up!&lt;/a&gt;&lt;/strong&gt;&quot;;
	}
}
?&amp;gt;</pre>
<p><strong>Step 1:</strong><br />
Add the comments to the top of your php file so WordPress knows it&#8217;s a plugin..</p>
<pre class="brush: php; title: ; notranslate">
/*
Plugin Name: Hello Stumbler
Version: 1.0
Plugin URI: http://www.fiddyp.co.uk/2007/09/06/hello-stumbler-wordpress-plugin-for-stumbleupon-visitors/
Author: Andy Bailey
Author URI: http://www.fiddyp.co.uk
Description: Adds a message to request a thumbs up if post is seen via Stumbleupon. Just place hellostumbler(); in your single post template
*/
</pre>
<p>The plugin URL is important, don&#8217;t be tempted to just put a link to the root of your site or blog, it&#8217;s really annoying when a plugin misbehaves and you click on the plugin name within wordpress only to be sent to a site where you can&#8217;t find the reference to the actual plugin.</p>
<p>With mine, I make the post about the plugin and then go back to the source code and add the permalink, zip, upload and finally edit the post with the link to the download.</p>
<p><strong>Step 2:</strong> Call the function a unique name</p>
<pre class="brush: php; title: ; notranslate">
function hellostumbler() {
</pre>
<p>Make sure your plugin has a unique name or it will misbehave if it&#8217;s used on a blog that has a duplicate named plugin.</p>
<p><strong>Step 3:</strong> Add the code that does the magic..</p>
<pre class="brush: php; title: ; notranslate">global $id;
	$refer=$_SERVER['HTTP_REFERER'];
	$title=the_title('','',false);
	if ($refer==&quot;http://www.stumbleupon.com/refer.php&quot; &amp;amp;&amp;amp; is_single()) {
		echo &quot;&lt;strong&gt; Thanks for Stumble-ing here!&lt;br /&gt;Please give me a &lt;a&gt;&lt;img&gt;thumbs up!&lt;/a&gt;&lt;/strong&gt;&quot;;
	}
}
?&amp;gt;</pre>
<p>This is a simple little bit of code, lets analyze it line by line&#8230;</p>
<pre class="brush: php; title: ; notranslate">$refer=$_SERVER['HTTP_REFERER'];</pre>
<p>all this does is find out what page the surfer came from and store it in the string <strong>$refer</strong></p>
<pre class="brush: php; title: ; notranslate">global $id;</pre>
<p>this assigns the variable <strong>$id</strong> as a global so you can use the value it has been given by the WordPress code</p>
<pre class="brush: php; title: ; notranslate">$title=the_title('','',false);</pre>
<p>this assigns the title of the post to the variable <strong>$title</strong> by using the internal function of WordPress, whatever is between the &#8221; , &#8221; is what gets put before and after the title of the post, the false bit means return the title instead of printing it out on the blog.</p>
<pre class="brush: php; title: ; notranslate">if ($refer==&quot;http://www.stumbleupon.com/refer.php&quot; &amp;amp;&amp;amp; is_single()) {</pre>
<p>a conditional check, if the value in <strong>$refer</strong> is the same as the one given (in this case the referring page of Stumbleupon) AND the post is a single post page (It&#8217;s better to Stumble a post on it&#8217;s own rather than when it&#8217;s on the front page). If BOTH cases are true, do whatever is in the &#8216;{&#8216; curly brackets</p>
<pre class="brush: php; title: ; notranslate">echo &quot;&lt;strong&gt; Thanks for Stumble-ing here!&lt;br /&gt;Please give me a &lt;a&gt;&lt;img&gt;thumbs up!&lt;/a&gt;&lt;/strong&gt;&quot;;</pre>
<p>echo means output to the page, putting html in the quotes writes html direct to the page. Then it&#8217;s a simple case of formatting the HTML so it works with the variables declared earlier. I&#8217;ll break this line down piece by piece..</p>
<ul>
<li>
<pre class="brush: php; title: ; notranslate">echo &quot;Thanks for Stumble-ing here! Please give me a </pre>
<p>Just output some text for the surfer to see</li>
<li>
<p>this is put into the source code so search engines and viewers of source can see where the next link comes from. Grabbed this from the Digg This plugin.</li>
<li>
<pre class="brush: php; title: ; notranslate">&lt;a href='http://www.stumbleupon.com/submit?url=&quot;.get_permalink($id).&quot;&amp;amp;title=$title'&gt;</pre>
<p>At the end of ?url= I close the echo quotes and use a dot (.) operator to add on the next bit that php sees, the get_permalink($id) just gets the link to the current post (it&#8217;s why we needed to have <strong>$id</strong> as global, WordPress has already declared what <strong>$id</strong> is) then we dot (.) a bit more echo output on to the end of that for the title name <strong>$title</strong> and close the html quotes with a single quote, and close the html a href bit with a &gt;</li>
<li>
<pre class="brush: php; title: ; notranslate">&lt;img&gt;thumbs up!&lt;/a&gt;&quot;;</pre>
<p>echo out html code for displaying the SU icon, close the img HTML and put what text to display as link and then close the html. Finally, close the echo quotes and add a semicolon (;) to tell php we have finsihed the command (echo).</li>
<li>
<pre class="brush: php; title: ; notranslate">}
}
?&amp;gt;</pre>
<p>close the &#8220;if&#8221; check, close the function and finally end the PHP</li>
</ul>
<p>Once you&#8217;ve done all that, upload the plugin to your wp-content/plugins/ directory and activate it, if all goes well, you should be able to add the output to anywhere on your page by calling the function name with</p>
<pre class="brush: php; title: ; notranslate"> if (function_exists(hellostumbler)){hellostumbler();}</pre>
<p>inserted into your template code.</p>
<p>This is what it looks like in action&#8230;<br />
<img src="http://fiddyp.co.uk/wp-content/uploads/2007/09/hellostumblerresult.jpg" alt="Hello Stumbler result" /></p>
<p>So, now there&#8217;s no reason why you can&#8217;t make a simple plugin to show a link to your facebook profile or add some code to show a Youtube video.</p>
<p>good luck, you&#8217;ll see that once you&#8217;ve made one plugin, you&#8217;ll want to make more and more! <img src='http://fiddyp.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>You can download all the source code here : <a href="http://www.fiddyp.co.uk/download/hellostumbler.zip">hello stumbler plugin</a></p>
<div class="aligncenter easyazon-info-block">
 <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20" class="easyazon-info-block-image">
  <img src="http://ecx.images-amazon.com/images/I/51PEqkiVKsL._SL160_.jpg" height="160" width="129" />
 </a>
 
 <div class="easyazon-info-block-non-image">
  <ul>
   <li>
    <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20">Teach Yourself VISUALLY WordPress</a>
   </li>
   <li>
    <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20">
     List Price: <strike>$29.99</strike>
    </a>
   </li>
   <li>
    <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20">
     Price: $17.91
    </a>
   </li>
   <li>
    <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20#customerReviews">
     Read Reviews 
    </a>
   </li>
    <a   href="http://www.amazon.com/dp/1118197879?tag=commentluv-20">
     <img alt="Buy Now Button" src="http://fiddyp.co.uk/wp-content/plugins/easyazon/resources/frontend/buy-now/amazon-us.gif" /> 
    </a>
  </ul>
 </div>
 
 <span class="easyazon-info-block-clear"></span>
</div>
]]></content:encoded>
			<wfw:commentRss>http://fiddyp.co.uk/how-to-make-a-wordpress-plugin-with-less-than-20-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

