<?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>Arricc &#187; PHP</title>
	<atom:link href="http://www.arricc.net/tags/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.arricc.net</link>
	<description>50% IT snippets that I couldn&#039;t readily find existing help on. 50% drivel.</description>
	<lastBuildDate>Mon, 05 Jul 2010 23:26:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress Front Page Single Post</title>
		<link>http://www.arricc.net/wordpress-front-page-single-post.php</link>
		<comments>http://www.arricc.net/wordpress-front-page-single-post.php#comments</comments>
		<pubDate>Fri, 11 Sep 2009 13:03:03 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[front page]]></category>

		<guid isPermaLink="false">http://www.arricc.net/?p=55</guid>
		<description><![CDATA[Well, I&#8217;ve rejigged my site theme, and I decided to play a bit with the layout. The look of the site seemed to be better with just the excerpt from a single post on the front page. Now, that sounds really straight forward and something that WordPress should be able to do out of the [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;ve rejigged my site theme, and I decided to play a bit with the layout.</p>
<p>The look of the site seemed to be better with just the excerpt from a single post on the front page.</p>
<p>Now, that sounds really straight forward and something that WordPress should be able to do out of the box. And it is. </p>
<p>However, if you want the &#8220;Older Entries&#8221; pages to then show, say, 10 posts you&#8217;re knackered as all subsequent pages will just show 1 entry. I tried the Custom Post Limits plugin, but it still didn&#8217;t work as page 2 started at post 6.</p>
<p>After reading a lot of entries on this topic (it seems I&#8217;m not the only person keen on this!) and getting nowhere fast. Lots of &#8220;read this link then work it out yourself&#8221; type replies I finally got something to work. Using both the offset AND paging attributes of the query_posts() function!</p>
<p>The only issue with this is that the last page wouldn&#8217;t show at all. This was due to the fact that the front page misses all but 1 of the entries, then the 2nd page starts at entry 2. In effect you&#8217;re missing a number of entries up to the usual number per page minus 1 &#8211; everything that would be on the last page. To get round this, I simply double the number of entries displayed on what WordPress believes is the final page.</p>
<p><span id="more-55"></span></p>
<p>To get this to work, add the following snippit to the top of the home.php file in your theme directory.<br />
If you don&#8217;t have a home.php file then copy your index.php in your theme directory to home.php which will then take precedence according to the <a href="http://codex.wordpress.org/Template_Hierarchy">WordPress Template Heirarcy</a>. I do not recommend adding this to your index.php file.</p>
<p><div class="codeblock"><code><span class="synSpecial">&lt;?php</span><br /><span class="synComment">//WATCH THAT LINE WRAP!</span><br /><span class="synStatement">if</span> <span class="synSpecial">(</span>is_home<span class="synSpecial">())</span> <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">page</span> <span class="synStatement">=</span> <span class="synSpecial">(</span>get_query_var<span class="synSpecial">(</span>'<span class="synConstant">paged</span>'<span class="synSpecial">))</span> <span class="synStatement">?</span> get_query_var<span class="synSpecial">(</span>'<span class="synConstant">paged</span>'<span class="synSpecial">)</span> <span class="synStatement">:</span> <span class="synConstant">1</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">page</span> <span class="synStatement">==</span> <span class="synConstant">1</span><span class="synSpecial">)</span> <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; query_posts<span class="synSpecial">(</span>&quot;<span class="synConstant">showposts=1&amp;paged=</span><span class="synStatement">$</span><span class="synIdentifier">page</span>&quot;<span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span> <span class="synStatement">else</span> <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">numposts</span> <span class="synStatement">=</span> get_option<span class="synSpecial">(</span>'<span class="synConstant">posts_per_page</span>'<span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synComment">//Work out what posts to show first on the page.</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">offset</span> <span class="synStatement">=</span> <span class="synSpecial">((</span><span class="synStatement">$</span><span class="synIdentifier">page</span> <span class="synConstant">-1</span><span class="synSpecial">)</span> <span class="synStatement">*</span> <span class="synStatement">$</span><span class="synIdentifier">numposts</span><span class="synSpecial">)</span> <span class="synStatement">-</span> <span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">numposts</span> <span class="synConstant">-1</span><span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synComment">//Quick hack to display double the number of posts on the last page as the offset hides posts per page -1.</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">page</span> <span class="synStatement">==</span> <span class="synStatement">$</span><span class="synIdentifier">wp_query</span><span class="synType">-&gt;</span>max_num_pages<span class="synSpecial">)</span> <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">numposts</span> <span class="synStatement">=</span> <span class="synConstant">2</span><span class="synStatement">*</span> get_option<span class="synSpecial">(</span>'<span class="synConstant">posts_per_page</span>'<span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; query_posts<span class="synSpecial">(</span>&quot;<span class="synConstant">offset=</span><span class="synStatement">$</span><span class="synIdentifier">offset</span><span class="synConstant">&amp;paged=</span><span class="synStatement">$</span><span class="synIdentifier">page</span><span class="synConstant">&amp;showposts=</span><span class="synStatement">$</span><span class="synIdentifier">numposts</span>&quot;<span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br /><span class="synSpecial">}</span><br /><span class="synSpecial">?&gt;</span><br /></code></div></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for WordPress Front Page Single Post" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+Wordpress+Front+Page+Single+Post" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/wordpress-front-page-single-post.php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Exchange Guid converter tool</title>
		<link>http://www.arricc.net/exchange-guid-converter-tool.php</link>
		<comments>http://www.arricc.net/exchange-guid-converter-tool.php#comments</comments>
		<pubDate>Tue, 18 Sep 2007 01:13:40 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.arricc.net/exchange-guid-converter.php</guid>
		<description><![CDATA[In response to the amount of comments I&#8217;ve had (which are way way more than I was ever expecting!) on my Exchange Mailbox Recovery article, I&#8217;ve written a script to convert your guids from the bad format that exmerge gives you to the one thats required for updating the user account. You can access it [...]]]></description>
			<content:encoded><![CDATA[<p>In response to the amount of comments I&#8217;ve had (which are way way more than I was ever expecting!) on my <a href="/exchange-2003-mailbox-recovery.php">Exchange Mailbox Recovery</a> article, I&#8217;ve written a script to convert your guids from the bad format that exmerge gives you to the one thats required for updating the user account.</p>
<p>You can access it <a href="/exchange-guid-converter.php">here</a>. Please leave any feedback on this post.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for Exchange Guid converter tool" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+Exchange+Guid+converter+tool" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/exchange-guid-converter-tool.php/feed</wfw:commentRss>
		<slash:comments>79</slash:comments>
		</item>
		<item>
		<title>LastFM for Drupal</title>
		<link>http://www.arricc.net/lastfm-for-drupal.php</link>
		<comments>http://www.arricc.net/lastfm-for-drupal.php#comments</comments>
		<pubDate>Wed, 22 Aug 2007 23:51:54 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://www.arricc.net/lastfm-for-drupal.php</guid>
		<description><![CDATA[So, I&#8217;ve been playing with Drupal recently. At first it did my head in, but then something sorta clicked. Not been near the Taxonomy module yet, but when I do I expect that process to reverse. Anyway, I decided I needed a module that will allow users to show their LastFM stuff on their profile [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been playing with <a href="http://www.drupal.org">Drupal</a> recently.</p>
<p>At first it did my head in, but then something sorta clicked. Not been near the Taxonomy module yet, but when I do I expect that process to reverse.</p>
<p>Anyway, I decided I needed a module that will allow users to show their LastFM stuff on their profile pages. I couldn&#8217;t find one so I wrote one.</p>
<p>I stared out with the <a href="http://drupal.org/project/onlinestatus">Onlinestatus</a> module as it did something very similar to what I was hoping to achieve.</p>
<p>Anyway, the module is attached should you feel so inclined. (Requires the profiles module I think. The one I based it on does anyway, so it probably does too.)</p>
<p>Download: <a id="p31" href="http://www.arricc.net/wp-content/uploads/lastfm.tar.gz">lastfm.tar.gz</a></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for LastFM for Drupal" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+LastFM+for+Drupal" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/lastfm-for-drupal.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
