<?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>RichardHole.co.uk &#187; Code</title>
	<atom:link href="http://richardhole.co.uk/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://richardhole.co.uk</link>
	<description>The Homepage of Richard Hole</description>
	<lastBuildDate>Sun, 07 Mar 2010 19:45:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Lazy Script</title>
		<link>http://richardhole.co.uk/code/lazy-script/</link>
		<comments>http://richardhole.co.uk/code/lazy-script/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 19:45:14 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://richardhole.co.uk/?p=89</guid>
		<description><![CDATA[Sometimes it's necessary to add data to a textarea through the use of a button on link. The script I'm about to show you allows you to do this very easily. Of course, this is only a very basic script and can be built on and improved. ]]></description>
			<content:encoded><![CDATA[<p>I was playing around with JavaScript and came across this script that allows the user to add predefined data to a forms&#8217; textarea with a click of a mouse. An example of where this could be used is  if code needed to quickly be added to a textarea (usually because of laziness ;P)</p>
<p>Here’s the code:</p>
<p>Put this in the head of your document:</p>
<pre>&lt;script language="JavaScript" type="text/JavaScript"&gt;
function AddItem(ItemId)
{
document.Form.textarea.value = document.Form.textarea.value + ItemId;
}
&lt;/script&gt;</pre>
<p>This is the form:</p>
<pre>&lt;form name="Form" method="post" action="post.php"&gt;
&lt;a href="#" onclick="AddItem('&lt;em&gt;&lt;/em&gt;');"&gt; Italic&lt;/a&gt;
&lt;textarea rows="10" name="textarea" cols="70"&gt;&lt;/textarea&gt; &lt;br /&gt;&lt;br /&gt;
&lt;/form&gt;</pre>
<p>How it works.</p>
<p>The mechanics of the script are simple. When the <code>onclick="AddItem();"</code> function is called the contents between the brackets of the onclick event is added to the textarea defined textarea. In this case the name of the textarea is ‘textarea’ and the name of the form is ‘Form’ so that’s what was changed in the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardhole.co.uk/code/lazy-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pensieve Plugin</title>
		<link>http://richardhole.co.uk/code/pensieve-plugin/</link>
		<comments>http://richardhole.co.uk/code/pensieve-plugin/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:27:18 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://richardhole.co.uk/?p=82</guid>
		<description><![CDATA[Being a huge fan of Harry Potter and of WordPress, I thought that it would be fun to edit the 'Hello Dolly' plugin that comes with WordPress and make it display Harry potter quotes. It only took me a few minuets but here is the result.]]></description>
			<content:encoded><![CDATA[<p>Being a huge fan of Harry Potter and of WordPress, I thought that it would be fun to edit the &#8216;Hello Dolly&#8217; plugin that comes with wordpress and make it display Harry potter quotes. It only took me a few minuets but here is the result.</p>
<h4>A few quotes</h4>
<p>Here are a few quotes included in the plugin:<br />
<q>To the well-organized mind, death is but the next great adventure.</q></p>
<p><q>Never trust anything that can think for itself if you can&#8217;t see where it keeps its brain</q></p>
<p><q>We are only as strong as we are united, as weak as we are divided</q></p>
<h4>Download</h4>
<p>You can download the <a href="../wp-content/uploads/2010/01/pensieve.zip">pensieve plugin</a> here ( Licensed under <a href="http://www.gnu.org/licenses/gpl.html">GPL</a>)</p>
<p>Got a potter quote you want me to add? then leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardhole.co.uk/code/pensieve-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>remove codeigniter index.php</title>
		<link>http://richardhole.co.uk/code/remove-codeigniter-index-php/</link>
		<comments>http://richardhole.co.uk/code/remove-codeigniter-index-php/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 20:41:50 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[codeigniter]]></category>

		<guid isPermaLink="false">http://richardhole.co.uk/?p=48</guid>
		<description><![CDATA[This is another old article, showing you how to remove the '/index.php/' that codeigniter calls, from the URL in the address bar; using a simple bit of .htacess code]]></description>
			<content:encoded><![CDATA[<p>In the process of developing with codeigniter I discovered that the .htaccess file wasn&#8217;t removing the index.php file from the URL, this is because I was using a sub directory. I did however find code that made this problem go away. Take a look:</p>
<pre>#this is for sub directory - http://localhost/appname
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]</pre>
<p>This then fixed the problem. But then when moving it over to a subdomain I ran into the same problem. So, I found some other code to help me fix the problem. Take a look:</p>
<p>In the .htaccess file of your root put this (change &#8216;myapp.mydomain.com to your full URL and change &#8216;myapp&#8217; to your subdomain name):</p>
<pre>RewriteCond %{HTTP_HOST}    ^myapp.mydomain.com$
RewriteCond %{REQUEST_URI}  !^/myapp/
RewriteRule (.*)            /myapp/$1 [last]</pre>
<p>This will direct your request to the .htacess file in your subdomain. You then need to put the following code in the .htacess file of your subdomain:</p>
<pre>Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?/$1[QSA]</pre>
<p>Problem solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardhole.co.uk/code/remove-codeigniter-index-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The power of WordPress &#8216;Links&#8217;</title>
		<link>http://richardhole.co.uk/code/the-power-of-wordpress-links/</link>
		<comments>http://richardhole.co.uk/code/the-power-of-wordpress-links/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 20:30:12 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://richardhole.co.uk/?p=32</guid>
		<description><![CDATA[The following is an old article written about how you can use wordpress links function to create a 'Currently reading' widget. This is now somewhat redundant because of custom fields, but it might be useful to someone.]]></description>
			<content:encoded><![CDATA[<h4>Ello ello, what&#8217;s all this then?</h4>
<p>WordPress links does exactly what it says on the tin, it displays links in your wordpress template whether its widgetized or not. But there&#8217;s so much more that the built in &#8216;Links&#8217; functionality can do. In this article we will look at how the &#8216;Links&#8217; functionality can be used to help make your life easier and do the same things that bespoke plugins have be made too do.</p>
<h4>I&#8217;ve Got The Power!</h4>
<p>Or more precisely WordPress has the power. We&#8217;ve all seen different hacks, workarounds and general hickory pokery used to show off the expandability of WordPress, so what I&#8217;m about to show isn&#8217;t anything special. In fact there will be no hacking or workarounds and most definitely no hickory pokery in this article; all we will be doing here is using the WordPress API to the advantage of the user i.e you.</p>
<h4>Get To The Point!</h4>
<p>Or more importantly the code. What i&#8217;m about to show you is a very basic use of the wordpress &#8216;Links&#8217; but hopefully those einsteins among will think of better uses than this. I&#8217;m going to show you how to create a &#8216;Currently Reading&#8217; widget (like the one in my sidebar) that will show the name of the book and a description of the book. This is easy enough to work out how to do if you read the WordPress Documentation but I thought I would share how I did it.</p>
<p>In the latest version of WordPress the <span style="text-decoration: underline;">wp_list_bookmarks()</span> function is used to call the bookmarks/Links and display them on the page so this is what were going to be using.</p>
<p>Here is the code used in the sidebar:</p>
<pre><code>&lt;?php wp_list_bookmarks('category_before= //The text that goes before each category. Defaults to &lt;li id="[category id]"&gt;
&amp;category_after= //Text that goes after each category. Defaults to &lt;/li&gt;
&amp;category_name=Currently Reading //The name of the category
&amp;show_images=0 //Display an image (in this case book cover).1=true 0=false&amp;show_description=1 //display description.
&amp;orderby=updated //Order it by the last updates bookmark
&amp;title_before=&lt;h4&gt; //what goes before the title
&amp;title_after=&lt;/h4&gt; //what goes after the title
&amp;show_name=1 //show the text link
&amp;between=&lt;br /&gt; //Text to place between each bookmark/image and its description. Defaults to '\n' (newline).
&amp;before=&lt;p&gt; //Text to place before each bookmark. Defaults to '&lt;li&gt;'.
&amp;after=&lt;/p&gt; //Text to place after each bookmark. Defaults to '&lt;/li&gt;'.
&amp;title_li=0 //Text for the heading of the list
&amp;categorize=0 //Bookmarks should be shown within their assigned Categories or not.
'); ?&gt;</code></pre>
<p>It should be noted that this code has been formatted for display reasons. This is how the code should be entered:</p>
<pre><code>&lt;?php wp_list_bookmarks('category_before=&amp;category_after= &amp;category_name=Currently Reading&amp;show_images=0&amp;show_description=1&amp;orderby=updated&amp;title_before=&lt;h4&gt;&amp;title_after=&amp;show_name=1&amp;between=&amp;before=&amp;after=&amp;title_li=0&amp;categorize=0'); ?&gt;</code></pre>
<p>This has just been thrown into a text widget that I called currently reading. For the code to be executed in the text widget you will need the <a title="exec php plugin" href="http://wordpress.org/extend/plugins/exec-php/">Exec-PHP plugin</a>. You can read the documentation about wp_list_bookmarks() on the <a title="wordpress codex" href="http://codex.wordpress.org/Template_Tags/wp_list_bookmarks">WordPress Codex</a>. The only thing left to do is create a link category called &#8216;Currently Reading&#8217; and add a bookmark with the name of your book, and image and a description, the plugin will do the rest.</p>
<h4>Room For Improvement</h4>
<p>This is a very simple and effective use of the WorPress links capability but there are many more ways to use this that more imaginative people could come up. If you liked this *cough* short article then why not leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardhole.co.uk/code/the-power-of-wordpress-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
