<?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>Candy by James &#187; Code</title>
	<atom:link href="http://james.gameover.com/index.php/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.gameover.com</link>
	<description>A journal by a James</description>
	<lastBuildDate>Fri, 23 Jul 2010 17:08:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=8438</generator>
		<item>
		<title>CSS3 @font-face browser support table</title>
		<link>http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/</link>
		<comments>http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 15:27:41 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=5328</guid>
		<description><![CDATA[It’s time for a CSS3 @font-face browser support table. One that documents specifically how browsers act when either the whole font family is specified (regular, italic, bold, bold-italic &#38; small-caps) or only the regular version of the font is specified. The test-case that this based on uses the ideal, easiest (laziest) implementation and can be [...]]]></description>
			<content:encoded><![CDATA[<p>It’s time for a CSS3 @font-face browser support table. One that documents specifically <em>how</em> browsers act when either the whole font family is specified (regular, <em>italic</em>, <strong>bold</strong>, <em><strong>bold-italic</strong></em> &amp; <span style="font-variant: small-caps;">small-caps</span>) or only the regular version of the font is specified. The <a href="http://james.gameover.com/zen/examples/font-face/index.html">test-case</a> that this based on uses <a href="http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/">the ideal, easiest (laziest) implementation</a> and can be found on <a href="http://james.gameover.com/zen/examples/font-face/index.html">its own page here</a>.</p>
<p>Here’s the results of how <em>current</em> browsers render the <a href="http://james.gameover.com/zen/examples/font-face/index.html">test case</a>, compared to the reference rendering.</p>
<h2>Can the browser pick up the style natively?</h2>
<table>
<tbody>
<tr>
<th></th>
<th>Firefox 3.6</th>
<th>Safari 4</th>
<th>Chrome 5</th>
<th>Opera 10.5a</th>
</tr>
<tr>
<td>Regular (Normal)</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Italic</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Bold</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Bold-Italic</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Small-Caps</td>
<td class="ok">Emulates</td>
<td class="ouch">Fallback system-font</td>
<td class="ouch">Fallback system-font</td>
<td class="ok">Emulates</td>
</tr>
<tr>
<td>Extras?</td>
<td>Ligatures!</td>
<td>-</td>
<td>-</td>
<td>Ligatures!</td>
</tr>
</tbody>
</table>
<h2>Can the browser emulate from the regular version?</h2>
<table>
<tbody>
<tr>
<th></th>
<th>Firefox 3.6</th>
<th>Safari 4</th>
<th>Chrome 5</th>
<th>Opera 10.5a</th>
</tr>
<tr>
<td>Regular (Normal)</td>
<td>(implied)</td>
<td>(implied)</td>
<td>(implied)</td>
<td>(implied)</td>
</tr>
<tr>
<td>Italic</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Bold</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Bold-Italic</td>
<td class="good">Yes</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
<td class="no-no-no">Fallback to regular-style</td>
</tr>
<tr>
<td>Small-Caps</td>
<td class="good">Yes</td>
<td class="ouch">Fallback system-font</td>
<td class="ouch">Fallback system-font</td>
<td class="good">Yes</td>
</tr>
<tr>
<td>Extras?</td>
<td>Ligatures!</td>
<td>-</td>
<td>-</td>
<td>Ligatures!</td>
</tr>
</tbody>
</table>
<p>The most<a href="http://james.gameover.com/zen/examples/font-face/index.html#results"> up to date support table</a>, with pretty colours, can always be found <a href="http://james.gameover.com/zen/examples/font-face/index.html#results">on its own page alongside the test case</a>. It also has more notes on ligature and small-caps support.</p>
<h2>Why is falling back to regular style so bad?</h2>
<p>It makes sentences <em><strong>full</strong> of expression</em> look like sentences full of expression. Thus removing part of the typographical elements of a text, whereas @font-face is meant to embellish it typographically.</p>
<h2>So what does this mean we should do?</h2>
<h3>Browser developers:</h3>
<ul>
<li>Please work on emulating <strong>bold</strong>, <em>italic</em>, <strong><em>bold-italic</em></strong>, etc. when they’re not present. Browsers do this already when it comes to system-fonts, which means web developers expect this to work. Falling back to the regular style (font-style:normal) is horrible as you lose all styling in a text.</li>
<li>Also give some thought to picking up “<span style="font-variant: small-caps;">font-variant:small-caps;</span>” in your @font-face code. It’s the only way to ensure proper fall-back. Emulating, like Firefox &amp; Opera do, is a step forward, but it’d be a pity to stop there.</li>
<li>If HTML 5 has taught us anything, it’s that <em>browsers</em> should be more bulletproof, not web designer’s code. Also: asking web developers to <a href="http://diveintohtml5.org/semantics.html#the-doctype">specify as little as possible</a> is a better.</li>
</ul>
<h3>Web designers:</h3>
<ul>
<li>Using @font-face when you only have the regular version of a font at your disposal is not a good idea. Especially for body text.</li>
<li>If you use small-caps text, chances are visitors will see the fallback system-font. So make sure you specify a system-font that matches your @font-face font nicely when rendered as small-caps. (The test-case uses an especially jarring one on purpose.)</li>
<li>Using a (less lazy, less practical) <a href="http://paulirish.com/2009/bulletproof-font-face-Implementation-syntax/">more bulletproof way of specifying your @font-face fonts is recommended (alas)</a> for now.</li>
</ul>
<p><a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/" rel="bookmark">CSS3 @font-face browser support table</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 20 February 2010.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Vertically centring in css (without hacks and multi-line enabled)</title>
		<link>http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/</link>
		<comments>http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 16:09:28 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=397</guid>
		<description><![CDATA[Chris Coyier over at css-tricks.com had a great example of a css conundrum: how to centre, both vertically and horizontally, multiple lines of text. He some good code (using table-cell) but his code for IE relied on some (script)expressions which can have the unfortunate habbit of slowing down a page. [update: to get a bit [...]]]></description>
			<content:encoded><![CDATA[<p>Chris Coyier over at css-tricks.com had a <a href="http://css-tricks.com/vertically-center-multi-lined-text/">great example of a css conundrum</a>: how to centre, both vertically and horizontally, multiple lines of text. He some good code (using table-cell) but his code for IE relied on some (script)expressions which can have the unfortunate habbit of slowing down a page.</p>
<p>[<strong>update</strong>: to get a bit more background on absolute &amp; relative positioning, and how to center horizontally, read:  <a href="/index.php/2005/on-horisontal-css-centering-using-absolute-positioning/">On Horizontal CSS Centering using Absolute Positioning or how Relative Positioning can rock your css</a>.]</p>
<p>The regular way of <a rel="nofollow" href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html">vertically centring in css</a> has been documented by Dušan Janovský back in 2004. It needs an extra div for its IE solution, but it doesn’t require any expressions, only regular (fast!) css. Because a div-tag is semantically empty (like the span-tag), it doesn’t add any wrong semantic meaning (like a table-tag would).</p>
<p>The <code>.area</code> div isn’t stricly necessary, but it was in the original problem posed in the css-tricks.com article. I have however edited out the superfluous background declaration, as it doesn’t have anything to do with positioning.</p>
<blockquote><p>I’ve updated the example to use <a href="http://www.simonclayson.co.uk/reportage/comments/ie_6_text_only/">conditional comments</a> instead of hacks. The html (in your page) becomes:</p>
<p><code>&lt;div class="area" id="two"&gt;<br />
&lt;div class="bubble"&gt;<br />
&lt;div&gt;<br />
&lt;p&gt;Doing this may not be as easy or obvious as we would hope.&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
</code></p>
<p>The css (in your stylesheet) becomes:</p>
<p><code>.area {width:300px; height:300px; position:relative; float:left; }<br />
.bubble {position:absolute; left:93px; top:21px; width:135px; height:84px; display:table; }<br />
.bubble div {display:table-cell; vertical-align:middle; text-align:center;}<br />
</code></p>
<p>The IE specific css (in your html-page) becomes:</p>
<p><code>&lt;!--[if lt IE 8]&gt;<br />
&lt;style&gt;<br />
.bubble div {position:absolute; top:50%;}<br />
.bubble div p {position:relative; top:-50%}<br />
&lt;/style&gt;<br />
&lt;![endif]–&gt;</code></p></blockquote>
<p>Have a <a href="http://css-tricks.com/examples/VerticallyCenteredText/">look at the demo</a> to see what you should end up with. Questions welcome!</p>
<p><a href="http://james.gameover.com/index.php/2009/vertically-centring-in-css-without-hacks-and-multi-line-enabled/" rel="bookmark">Vertically centring in css (without hacks and multi-line enabled)</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 14 July 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS3 Fonts: The ideal implementation</title>
		<link>http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/</link>
		<comments>http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 15:00:15 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=408</guid>
		<description><![CDATA[This series of articles is about the challenges that arise when using @font-face. Font licensing is one (that many others have written about) and the file-size of included font-files is another, but this article is about browser implementation eccentricities. I’ll start off by showing the ideal @font-face implementation in this article, before moving on to [...]]]></description>
			<content:encoded><![CDATA[<p>This series of articles is about the challenges that arise when using @font-face. Font licensing is one (that <a href="http://dbaron.org/log/20090317-fonts">many</a> <a href="http://blogs.msdn.com/b/ie/archive/2008/07/21/font-embedding-on-the-web.aspx">others</a> <a href="http://blog.typekit.com/2009/06/11/when-free-fonts-arent-free/">have</a><a href="http://www.webdirections.org/blog/the-return-of-font-embedding-to-the-web/"> written</a> about) and the file-size of included font-files is another, but this article is about browser implementation eccentricities. I’ll start off by showing the ideal @font-face implementation in this article, before moving on to showing current browser deficiencies and the implementation I settled on for including a full font-family which works in the here and now.</p>
<p><strong>update</strong>: For an <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">overview of current browser support</a> for CSS3’s @font-face see the <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">browser support tables</a>.</p>
<p>Ideally, designers would specify the font-file they wanted to use for regular text, and then one for each variation they had at their disposal (so, one for Bold, Italic, Bold Italic, Small Caps, Light, Ultra Condensed, etc.) – all using the same font-family name, so that all variations would be picked up automatically for body text, and, if @font-face isn’t supported by the browser,  all text will still display in the proper font-variant.</p>
<blockquote><p>To do that, your css would look something like this:</p>
<p><code>/* A font by Jos Buivenga (exljbris) -&gt; www.exljbris.nl */<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_R_45b.otf) format("opentype");<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_B_45b.otf) format("opentype");<br />
font-weight: bold;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_I_45b.otf) format("opentype");<br />
font-style: italic;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_BI_45b.otf) format("opentype");<br />
font-style: italic;<br />
font-weight: bold;<br />
}<br />
@font-face {font-family: "Fontin Sans";<br />
src: url(fonts/Fontin_Sans_SC_45b.otf) format("opentype");<br />
font-variant: small-caps;<br />
}</code></p></blockquote>
<p>This would ensure proper fall-back in browsers that don’t support @font-face (or only part of it) and compatibility with current stylesheets, making @font-face implementation for designers plug-&amp;-play.</p>
<p>The <em>ideal</em> @font-face rendering (on the left) and fall-back rendering (on the right) would look a little like this (notice the fi-ligature!):</p>
<div class="insertimg"><a title="ideal-fallback by James John Malcolm, on Flickr" href="http://james.gameover.com/zen/examples/font-face/index.html#results"><img src="http://farm3.static.flickr.com/2620/3713309878_a9fb7bd82e.jpg" alt="ideal-fallback" width="500" height="209" /></a></div>
<p>You’ll have guessed by now that browsers haven’t reached this ideal implementation yet. You can find <a href="http://james.gameover.com/index.php/2010/css3-font-face-browser-support-table/">the test-case and CSS3 @font-face browser support tables here</a>.</p>
<p><em>Information in this series was acquired while <a href="http://james.gameover.com/index.php/portfolio/#s-next">working on the design and css</a> for the site of Standards.next and subsequent tests afterwards. The Fontface used in this example is <a href="http://www.josbuivenga.demon.nl/fontinsans.html">Fontin Sans by Exljbris (Jos Buivenga)</a></em><em>.</em></p>
<p><a href="http://james.gameover.com/index.php/2009/css-3-fonts-the-ideal/" rel="bookmark">CSS3 Fonts: The ideal implementation</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 12 July 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve your WordPress: related posts for 404’s</title>
		<link>http://james.gameover.com/index.php/2009/improve-your-wordpress-related-posts-for-404s/</link>
		<comments>http://james.gameover.com/index.php/2009/improve-your-wordpress-related-posts-for-404s/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 15:40:53 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=161</guid>
		<description><![CDATA[Second in a series of articles about tinkering with improving your WordPress installation, we return to custom 404 error pages; adding a list of possibly related posts when visitors have followed an outdated link. Other 404 error page improvements can be found in the first article of this series. One of the most useful things on [...]]]></description>
			<content:encoded><![CDATA[<p>Second in a series of articles about <span style="text-decoration: line-through;">tinkering with</span> improving your WordPress installation, we return to custom 404 error pages; adding a list of possibly related posts when visitors have followed an outdated link. Other <a href="http://james.gameover.com/index.php/2009/improve-your-wordpress-the-404-error-page/">404 error page improvements</a> can be found in the first article of this series.</p>
<p>One of the most useful things on a 404 page is a direct link to the page visitors were <em>trying</em> to get to. Now we can’t read minds, but we do know the URI (<a href="http://james.gameover.com/index.php/2009/improve-your-wordpress-the-404-error-page/">explained in the third paragraph of the previous article</a>) and that’s good enough. The following code is adapted from <a href="http://archgfx.net/blog/2007/geek/blogging/adding-search-results-to-wordpress-404-pages">this archGFX article</a>. The method used to transform the URI into a search query is very simple. If you would like a more advanced please refer to<a href="http://blog.urbanmainframe.com/2009/01/a-better-404-redux/"> “A better 404 — Redux” at Urban Mainframe</a>, where Jonathan Hollin expounds on his (downloadable!) 404 page code.</p>
<p>There are two parts to this “related posts” code. The first part makes it possible to get from “/wrong/link.html” (the URI) to “wrong link” (the search query).<span id="more-161"></span></p>
<blockquote><p>Here it is:</p>
<p><code>&lt;?php</p>
<p>$search_term = substr($_SERVER[’REQUEST_URI’],1);</p>
<p>$search_term = urldecode(stripslashes($search_term));</p>
<p>$find = array (“’.html’”, “‘[-/_]’”) ;</p>
<p>$replace = ” ” ;</p>
<p>$search_term = trim(preg_replace ( $find , $replace , $search_term ));</p>
<p>$search_term_q = preg_replace(‘/ /’, ‘%20′, $search_term);</p>
<p>?&gt;</code></p>
<p>That’s all there is to it. If you, however, don’t want to make “/wrong/link.html” into “wrong link”, but rather just “link” (because the first part of the URI is likely to be useless), use the following on the fourth line:</p>
<p><code>$find = array ("'.html'", "'.+/'", "'[-/_]'") ;</code></p></blockquote>
<p>The second part consists of telling WordPress to use the search terms and outputting a list of articles based on the results.</p>
<blockquote><p>In this case the loop will output a linked title, a line-break and then the date of the article. You can edit out the line-break and the date if you want. Also, you can change OL to UL if you want an unordered list outputted.<br />
<code><br />
&lt;?php</p>
<p>query_posts(‘s=’. $search_term_q );</p>
<p>if ( have_posts() ) :</p>
<p>?&gt;</p>
<p>&lt;h1&gt;Possibly related content&lt;/h1&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&lt;li&gt;&lt;a href=”&lt;?php the_permalink() ?&gt;”&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;</p>
<p>&lt;br&gt;</p>
<p>&lt;?php unset($previousday); printf(__(‘%1$s’, ‘sandbox’), the_date(”, ”, ”, false), get_the_time()) ?&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;?php  endwhile; ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&lt;?php else : endif; ?&gt;</code></p></blockquote>
<p>That’s all there is to it! Once you’ve added this code <a href="http://james.gameover.com/404">your 404 error page should look a little something like this</a>.</p>
<blockquote><p>To conclude, add the following to your 404.php, wherever you think it fits best, to add :</p>
<p>&lt;?php /* Transforming the URI into search terms */</p>
<p>$search_term = substr($_SERVER[’REQUEST_URI’],1);</p>
<p>$search_term = urldecode(stripslashes($search_term));</p>
<p>$find = array (“’.html’”, “‘[-/_]’”) ;</p>
<p>/* If you only want the last term of the URI, use the following instead:</p>
<p>$find = array (“’.html’”, “‘.+/’”, “‘[-/_]’”) ;  */</p>
<p>$replace = ” ” ;</p>
<p>$search_term = trim(preg_replace ( $find , $replace , $search_term ));</p>
<p>$search_term_q = preg_replace(‘/ /’, ‘%20′, $search_term);</p>
<p>?&gt;</p>
<p>&lt;?php <span style="line-height: 37px;">/* Use the search terms to run a query */ </span></p>
<p>query_posts(‘s=’. $search_term_q );</p>
<p>/* check to see if there are posts */</p>
<p>if ( have_posts() ) :</p>
<p>?&gt;</p>
<p>&lt;h1&gt;Possibly related content&lt;/h1&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php /* start the loop */  while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&lt;li&gt;&lt;a href=”&lt;?php the_permalink() ?&gt;”&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;</p>
<p>&lt;br&gt;</p>
<p>&lt;?php unset($previousday); printf(__(‘%1$s’, ‘sandbox’), the_date(”, ”, ”, false), get_the_time()) ?&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;?php /* end the loop */  endwhile; ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&lt;?php else : endif; ?&gt;</p></blockquote>
<p>If you’ve any questions, don’t hesitate to ask!</p>
<p><a href="http://james.gameover.com/index.php/2009/improve-your-wordpress-related-posts-for-404s/" rel="bookmark">Improve your WordPress: related posts for 404’s</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 8 January 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Improve your WordPress: the 404 error page</title>
		<link>http://james.gameover.com/index.php/2009/improve-your-wordpress-the-404-error-page/</link>
		<comments>http://james.gameover.com/index.php/2009/improve-your-wordpress-the-404-error-page/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 17:56:30 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.gameover.com/?p=139</guid>
		<description><![CDATA[First in a series of articles about tinkering with improving your wordpress installation, today we tackle custom 404 error pages; the page everyone dreads getting when they’ve followed an outdated link. Four-Oh-Fours are hot again! Just recently came a across the article A Better 404. I remember reading the A List Apart article “A Perfect [...]]]></description>
			<content:encoded><![CDATA[<p>First in a series of articles about <span style="text-decoration: line-through;">tinkering with</span> improving your wordpress installation, today we tackle custom 404 error pages; the page everyone dreads getting when they’ve followed an outdated link.</p>
<p>Four-Oh-Fours are hot again! Just recently came a across the article <a href="http://blog.urbanmainframe.com/2008/11/a-better-404/">A Better 404</a>. I remember reading <a href="http://www.alistapart.com/articles/perfect404/">the A List Apart article “A Perfect 404″</a> ages ago, but had never done anything about it. Time to improve. </p>
<p>First some quick vocab: the part after your .com (or .co.uk) is called the URI, so if www.google.com/analytics/provision/ is the address,  /analytics/provision/ would be the URI. The URI is the part that’s wrong when someone’s followed a outdated link which means we can use the URI to create a more helpful 404 page. To create a 404 page for your WordPress theme just create a 404.php file in the directory of your theme (/wp-content/themes/default/ is the default).<span id="more-139"></span></p>
<blockquote><p>The default wordpress 404 page code looks something like this:</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&lt;h1&gt;Nothing Found (Error 404)&lt;/h1&gt;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p></blockquote>
<p>Which I suppose is functional enough, but doesn’t actually help the user much, depending on the content of your sidebar. The first thing to do is to tell programmes visiting  (browsers and more importantly search engine spiders!) that the page is a 404 error page.</p>
<blockquote><p>You do that by adding the following to the top of your 404.php:</p>
<p>&lt;?php ob_start(); ?&gt;</p>
<p>&lt;?php header(“HTTP/1.1 404 Not Found”); ?&gt;</p>
<p>This “HTTP/1.1 404 Not Found” message tells spiders exactly what they need to know.</p></blockquote>
<p>Next up, adding useful things for human users! There are three main things you can do to be helpful. Telling the user <em>exactly</em> what’s wrong, giving them a list of related articles and listing your recent articles. Related articles requires some URI magic which I haven’t figured out yet, but <a href="http://blog.urbanmainframe.com/">Jonathan Hollin</a> has, so stay tuned for an article from him which I’ll link to when the time comes.</p>
<blockquote><p>Telling the user exactly what’s wrong goes a little something like this:</p>
<p>&lt;blockquote&gt;</p>
<p>&lt;?php // When the visitor is linked through by another site or page</p>
<p>if ($_SERVER[’HTTP_REFERER’]) { ?&gt;</p>
<p>&lt;p&gt;The link at &lt;em&gt;&lt;a href=”&lt;?php echo $_SERVER[’HTTP_REFERER’];?&gt;”&gt;</p>
<p>&lt;?php echo chunk_split($_SERVER[’HTTP_REFERER’], 25);?&gt;</p>
<p>&lt;/a&gt;&lt;/em&gt; is incorrect or &lt;em&gt;&lt;?php echo $_SERVER[’REQUEST_URI’];?&gt;&lt;/em&gt; has been moved, renamed or deleted.&lt;/p&gt;</p>
<p>&lt;?php } // When the visitor isn’t linked through (most likely a bookmark)</p>
<p>else { </p>
<p>echo “&lt;p&gt;&lt;em&gt;” . $_SERVER[’REQUEST_URI’] . “&lt;/em&gt;”;</p>
<p>?&gt;</p>
<p>has been moved, renamed or deleted.&lt;/p&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&lt;/blockquote&gt;</p></blockquote>
<p>As the comments in the code make clear, there are two situations to tailor for: when people come in from another site and when they don’t. A nice addition is “echo chunk_split($_SERVER[’HTTP_REFERER’], 25)” which echo’s (outputs) the HTTP_REFERER (the site where the user was linked from) in little blocks of 25 characters. This way long URLs still wrap nicely. I chose 25 characters as that’ll put “http://james.gameover.com” all on one line.</p>
<blockquote><p>That just leaves a list of some recent posts to add:</p>
<p>&lt;h1&gt;Recent Posts&lt;/h1&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php $postslist = get_posts(‘numberposts=6′);</p>
<p>foreach ($postslist as $post) :</p>
<p>setup_postdata($post); ?&gt;</p>
<p>&lt;li&gt;&lt;a href=”&lt;?php the_permalink(); ?&gt;”&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;</p>
<p>&lt;?php endforeach; ?&gt;</p>
<p>&lt;/ol&gt;</p></blockquote>
<p>This code simply outputs a linked title of the 6 most recent journal entries in a numbered list. Simple!</p>
<blockquote><p>So, to recap, you’ll end up with something like this as your final code in the 404.php file:</p>
<p>&lt;?php ob_start(); ?&gt;</p>
<p>&lt;?php header(“HTTP/1.1 404 Not Found”); ?&gt;</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p> </p>
<p>&lt;h1&gt;Nothing Found (Error 404)&lt;/h1&gt;</p>
<p> </p>
<p>&lt;blockquote&gt;</p>
<p>&lt;? if ($_SERVER[’HTTP_REFERER’]) { ?&gt;</p>
<p>&lt;p&gt;The link at &lt;em&gt;&lt;a href=”&lt;?php echo $_SERVER[’HTTP_REFERER’];?&gt;”&gt;</p>
<p>&lt;?php echo chunk_split($_SERVER[’HTTP_REFERER’], 25);?&gt;</p>
<p>&lt;/a&gt;&lt;/em&gt; is incorrect or &lt;em&gt;&lt;?php echo $_SERVER[’REQUEST_URI’];?&gt;&lt;/em&gt; has been moved, renamed or deleted.&lt;/p&gt;</p>
<div>&lt;?php } else { </div>
<p>echo “&lt;p&gt;&lt;em&gt;” . $_SERVER[’REQUEST_URI’];</p>
<p>?&gt;</p>
<p>&lt;/em&gt; has been moved, renamed or deleted.&lt;/p&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&lt;/blockquote&gt;</p>
<p> </p>
<p>&lt;p&gt;Don’t worry, just try again!&lt;/p&gt;</p>
<p> </p>
<p>&lt;h1&gt;Recent Posts&lt;/h1&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php $postslist = get_posts(‘numberposts=6′);</p>
<p>foreach ($postslist as $post) :</p>
<p>setup_postdata($post); ?&gt;</p>
<p>&lt;li&gt;&lt;a href=”&lt;?php the_permalink(); ?&gt;”&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;</p>
<p>&lt;?php endforeach; ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p></blockquote>
<p>You can visit <a href="http://james.gameover.com/try/a/link">the final 404 error page here</a>. Many thanks to <a title="go to: Who Am I?" href="http://blog.urbanmainframe.com/colophon/who-am-i/">Jonathan M. Hollin</a> for much of the code and ideas, and to the <a href="http://codex.wordpress.org/Main_Page">WordPress Codex</a> and <a href="http://de3.php.net/chunk_split">php.net</a> for being such handy recourses.</p>
<p><strong>Update</strong>: Added “Possibly related content” to my 404 pages, followup post will come later.</p>
<p><a href="http://james.gameover.com/index.php/2009/improve-your-wordpress-the-404-error-page/" rel="bookmark">Improve your WordPress: the 404 error page</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 1 January 2009.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Inserting pages into category archives in wordpress</title>
		<link>http://james.gameover.com/index.php/2008/inserting-pages-into-category-archives-in-wordpress/</link>
		<comments>http://james.gameover.com/index.php/2008/inserting-pages-into-category-archives-in-wordpress/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 22:00:59 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://james.gameover.com/index.php/2008/inserting-pages-into-category-archives-in-wordpress/</guid>
		<description><![CDATA[Wouldn’t it be handy if you could have a little story at the top of your archive pages (or other templates), explaining exactly what’s what? And wouldn’t it be handy if that little story was fully wysiwyg editable? I thought so. Sites in WordPress (WP) have “posts” which go into categories and “pages”, which are [...]]]></description>
			<content:encoded><![CDATA[<p>Wouldn’t it be handy if you could have a little story at the top of your archive pages (or other templates), explaining exactly what’s what? And wouldn’t it be handy if that little story was fully wysiwyg editable? I thought so.</p>
<p>Sites in WordPress (WP) have “posts” which go into categories and “pages”, which are independent. My cunning plan was to name pages exactly the same as the categories I wanted them to describe, and then insert them into the archive page. It has been quite a search to get all the right code, even though the end result looks quite simple!</p>
<p>The first thing you do, is create a category (”One &amp; One”) and create a page (with the title “One &amp; One”). Secondly, you open up your archive.php template file.</p>
<blockquote><p>You should see something like the following in it:</p>
<p><em>&lt;?php if (have_posts()) : ?&gt;</em></p>
<p>And also, further along:</p>
<p><em> &lt;?php while (have_posts()) : the_post(); ?&gt; </em></p></blockquote>
<p><span id="more-94"></span><br />
Those two statements start off  “The Loop”, which is wordpress lingo for the php-statements which produce the desired output (like posts or lists of them) in a template. We’re going to put our blurb above it. You can also put it under “The Loop” (the “main” loop really) if you so wish — no extra code needed.</p>
<blockquote><p>Simply put:</p>
<p><em>&lt;?php<br />
</em></p>
<p><em>$getcategory = $wp_query-&gt;get_queried_object();</em></p>
<p><em>$pagetoget = ‘pagename=’ . $getcategory-&gt;category_nicename;</em></p>
<p><em>$seperate_query = new WP_Query($pagetoget); </em></p>
<p><em>/* Next…we start our own WordPress Loop, based on the seperate query (as seen above). That way we can still use the main query! */?&gt;</em></p>
<p><em>&lt;?php while ($seperate_query-&gt;have_posts()) : $seperate_query-&gt;the_post(); ?&gt;</em></p>
<p><em>&lt;div id=“blurb”&gt;</em></p>
<p><em>&lt;h3&gt;Standard blurb for: &lt;?php echo  single_cat_title(”, false);  ?&gt;&lt;/h3&gt;</em></p>
<p><em>&lt;?php the_content() ?&gt;</em></p>
<p><em>&lt;/div&gt;</em></p>
<p><em>&lt;br style=“clear:both;”&gt;</em></p>
<p><em>&lt;?php endwhile; ?&gt;</em></p>
<p><em>&lt;?php rewind_posts();  /* This “rewinds” the loop, so we can use another loop after it safely.*/ ?&gt;</em></p>
<p>Infront of the start of the main loop in your archive.php, so above of the following line:</p>
<p><em>&lt;?php if (have_posts()) : ?&gt;</em></p></blockquote>
<p>And that’s all the code that’s needed!</p>
<p>Let me explain what the code actually does. The first two lines — <em>$getcategory = $wp_query-&gt;get_queried_object(); $pagetoget = ‘pagename=’ . $getcategory-&gt;category_nicename; </em> — ask WP for the “category slug” or the “nicename” of the category. That’s the sanitized version of “One &amp; One” in this case, which is “one-one”.</p>
<p>This “category slug” is handy, because “one-one” will also be the “page slug”, so it’ll match the sanitized name of the page we want to insert into our category archive. We get our page by doing — <em>$seperate_query = new WP_Query($pagetoget);  while ($seperate_query-&gt;have_posts()) : $seperate_query-&gt;the_post();</em> — that starts a new, completely seperate loop from the main loop that will follow.</p>
<p>Then all that’s left is to insert the page’s content like so — <em>&lt;?php the_content() ?&gt;</em> — and then end and rewind the loop with the following statements — <em>&lt;?php endwhile; ?&gt; &lt;?php rewind_posts(); ?&gt;</em> .</p>
<p>You can see I’ve added a div around the content-insertion and <em>&lt;br style=“clear:both;”&gt; </em>after it. That prepares you for any floating-images that may be part of the inserted page’s content. The <em>&lt;h3&gt;Standard blurb for: &lt;?php echo  single_cat_title(”, false);  ?&gt;&lt;/h3&gt;</em> is there mainly to know what I’m doing (when working on it) and to seperate it out from the listing of category content that will follow after the blurb. I’ve left it in the example so you know how to get both the sanitized “category slug” and the regular “category title”, which this produces.</p>
<p>This code works in the standard WordPress 2.6 template based on K2 and should work in pretty much all other templates too. Many thanks to <a href="http://noscope.com/">Joen</a> and <a href="http://www.google.de/">Google</a> for their help.</p>
<p><a href="http://james.gameover.com/index.php/2008/inserting-pages-into-category-archives-in-wordpress/" rel="bookmark">Inserting pages into category archives in wordpress</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 9 August 2008.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bye bye liquid layouts!</title>
		<link>http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/</link>
		<comments>http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 16:59:45 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/</guid>
		<description><![CDATA[Yes, I am predicting the death of liquid layout of web pages. Not all mind you, some web apps will still be liquid, but for the rest of the web: liquid is dead. This is a natural next step after declaring elastic layouts dead, so no surprises here. There are three main ways to define your [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I am predicting the death of liquid layout of web pages. Not all mind you, some web apps will still be liquid, but for the rest of the web: liquid is dead. This is a natural next step after <a href="http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/">declaring elastic layouts dead</a>, so no surprises here.</p>
<p>There are three main ways to define your layout in web design: fixed, elastic &amp; liquid. Having <a href="http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/">written about the differences between them</a> before, I’ll suffice with stating that fixed layouts are defined in “px” (pixels) and liquid ones in “%” (percentages).</p>
<p>Using a fixed layout means your web page is the same width irrespective of the viewers’ screen width, like so:</p>
<div class="insertimg"><img src="/zen/jjm-fixed-width-design.jpg" alt="Fixed layout." /></div>
<p>Using a liquid layout however, means your web page scales along with the viewers’ screen width, like so:</p>
<div class="insertimg"><img src="/zen/jjm-flexible-width-design.jpg" alt="Liquid layout." /></div>
<p>Liquid layouts used to have an edge over pixel layouts in the sense that they increased use of the screen real estate, thus providing more room if the viewer increased their text-size. <strong>Line-lengths are hard to control with liquid layouts</strong>, because of varying screen-sizes obviously, but also when the viewer increases (just) the text-size. Jason Kottke posted a <a href="http://www.kottke.org/01/05/attention-liquid-designers-take-a">good warning about line-lengths in liquid layouts</a> a while back:</p>
<blockquote><p>Attention liquid designers: take a gander at <a href="/zen/papyrus.jpg">this portion of an ancient Egyptian parchment</a> on papyrus from the Louvre. Even the ancient Egyptians knew not to make columns of text too wide.</p></blockquote>
<p>Now, however, most browsers have adopted full-page zooming over text-size zooming. Most provide both, but full-page zooming is the new default. Full-page zooming gives users with a wider screen (for example) the chance to increase the size of text and images, while still preserving the ratios of fixed layout pages, like so:</p>
<div class="insertimg"><img src="/zen/jjm-fixed-width-design-full-zoom.jpg" alt="Fixed design with full zoom." /></div>
<p>As you can see, full-page zooming means fixed layouts also provide increased use of screen real estate, but only <em>when needed</em>. In addition fixed layouts keep line-lengths relatively stable, and are easy to work with as they are based on pixels, just like images, videos and other objects you may have on your web page.</p>
<p><a href="http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/" rel="bookmark">Bye bye liquid layouts!</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 8 June 2008.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Px vs Em: Is it still relevant?</title>
		<link>http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/</link>
		<comments>http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 11:40:16 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/</guid>
		<description><![CDATA[You used to have to choose. Choose between an easy, but inflexible, px-based layout or a hard to control, but flexible, em-based layout. Now with full-page zoom being implemented (as default!) in Internet Explorer 7, Firefox 3 and Opera 9*, it’s a different story. Full-page zooming means your easy px-based layout will be fully flexible. [...]]]></description>
			<content:encoded><![CDATA[<p>You used to have to choose. Choose between an easy, but inflexible, px-based layout or a hard to control, but flexible, em-based layout.</p>
<p>Now with full-page zoom being implemented (as default!) in Internet Explorer 7, Firefox 3 and Opera 9*, it’s a different story. Full-page zooming means your easy px-based layout will be fully flexible. Even more flexible than most em-based layouts in fact, as images will scale along too.</p>
<p>So I’m asking myself, why bother with hard-to-keep-from-breaking em-based layouts?</p>
<p><strong>[update]</strong> I don’t think <a href="http://james.gameover.com/index.php/2008/bye-bye-liquid-layouts/">liquid layouts are relevant</a> anymore either.</p>
<p><strong>[update 2]</strong> * And now Safari too! That’s all of the major browsers.</p>
<p>PS. <em>This still leaves percentage-based layouts of course, but they maximise screen real estate. Which is very different from maximising readability (line-lengths and all that jazz). As far as I can see, %-based layouts are good for some web-apps (like gmail) but aren’t optimal for other uses.</em></p>
<p><a href="http://james.gameover.com/index.php/2008/px-vs-em-is-it-still-relevant/" rel="bookmark">Px vs Em: Is it still relevant?</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 31 March 2008.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>No business benefits for microformats</title>
		<link>http://james.gameover.com/index.php/2007/no-business-benefits-for-microformats/</link>
		<comments>http://james.gameover.com/index.php/2007/no-business-benefits-for-microformats/#comments</comments>
		<pubDate>Wed, 09 May 2007 12:30:18 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Buzz]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Worthy]]></category>

		<guid isPermaLink="false">http://james.gameover.com/index.php/2007/no-business-benefits-for-microformats/</guid>
		<description><![CDATA[Over the past year there’s been a lot of attention (in certain circles) for “microformats”. Essentially, microformats are standardisations of class-values to use in html. The implied benefit is that any 3rd party (be it a browser or another site) could easily gain access to that information and be able to do something useful with [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past year there’s been <a href="http://www.colly.com/?/comments/the-business-benefits-of-microformats/">a lot of attention</a> (in certain circles) for “microformats”. Essentially, microformats are standardisations of class-values to use in html. The implied benefit is that any 3rd party (be it a browser or another site) could easily gain access to that information and be able to do something useful with it.</p>
<p>However, aside from a few practical issues, microformats are a fundamentally flawed idea.</p>
<p>Microformats are an attempt at <em>client side</em> innovation. Looking at the history of (x)html, javascript and css (the three main client side technologies), you can see it’s rife with incompatibilities. The standardised versions of said technologies have also had (and continue to have) very long market penetration times (the time it takes for the support of a technology to spread among end users).</p>
<p>The funny thing is that these problems can be mitigated by something very simple; <em>server side</em> innovation! It’d have a couple of huge advantages. First-off, it’d give more control over the user experience. Since microformats <strong>don’t define</strong> how they should be handled by User Agents (UA’s, like browsers or mail clients), you have <strong>no way of knowing</strong> how your code will exactly be interpreted by them.</p>
<p>Secondly, it allows you to use more compatible technology on the client side (html, css, vCards, pdf, you name it). This means it would work, <em>right now</em>, for everyone. Also, especially for sites that use a CMS (system to manage a sites’ content), server side solutions are a lot easier to implement.</p>
<blockquote><p>A few examples of microformats, and an explanation why they don’t provide any (business) benefits:</p>
<p>hCard — Have extra mark-up so you can point to an external site which produces a vCard? Mark-up which might force you to deal with UA’s which may mess up the resulting vCard because they interpret hCards differently? Why not just upload a vCard or have your CMS generate a vCard automatically?</p>
<p>hAtom — Making the page itself it’s own feed? So the full, heavy, page can be pinged by feed readers all the time, using far more bandwidth and messing up stats? Are you kidding me?</p></blockquote>
<p>So yes, I do think that microformats are not worth implementing yourself.</p>
<p><a href="http://james.gameover.com/index.php/2007/no-business-benefits-for-microformats/" rel="bookmark">No business benefits for microformats</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 9 May 2007.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I use HTML (instead of xHTML)</title>
		<link>http://james.gameover.com/index.php/2006/why-i-use-html-instead-of-xhtml/</link>
		<comments>http://james.gameover.com/index.php/2006/why-i-use-html-instead-of-xhtml/#comments</comments>
		<pubDate>Mon, 11 Sep 2006 20:39:03 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hypertext]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/index.php/2006/why-i-use-html-instead-of-xhtml/</guid>
		<description><![CDATA[Sean of Elementary Group Standards asked me, as part of a CSS Spring Reboot 2006 questionnaire, why I used HTML 4. Was using HTML instead of xHTML a concious choice on my part? Absolutely. While the other people who were questioned managed to keep it nice and concise, I managed to write up a whole [...]]]></description>
			<content:encoded><![CDATA[<p>Sean of <a href="http://www.elementary-group-standards.com">Elementary Group Standards</a> asked me, as part of a CSS Spring Reboot 2006 questionnaire, why I used HTML 4. Was using HTML instead of xHTML a concious choice on my part? Absolutely.</p>
<p>While the other people who were questioned managed to keep it nice and concise, I managed to write up a whole bucket load of words about it. As others asked me why I made sure Bite Size Standards is HTML 4, I’ve decided to post my answer here too.</p>
<p>As <a href="http://www.elementary-group-standards.com/html/why-do-you-use-html-4">published on Elementary Group Standards</a>:</p>
<blockquote><p>“I’ve used xHTML for 5 years, from 2001 til 2006. My original reason for using it was that it is supposed to be the future. It would have benefits like in-line SVG and MathML. It was presented as TheThingToUse™ with CSS.</p>
<p>There are two things about xHTML which make it a poor choice for (public) sites. Both of them have to do with xHTML’s mime-types. In short, xHTML can be sent with text/html or application/xhtml+xml as the mime-type. On the web xHTML is usually sent as text/html, as Internet Explorer (which has 83+% market share) doesn’t support the other mime-type. Both mime-types are valid for xHTML 1.0, but (supporting) browsers do handle them differently.</p>
<p>It’s the handling of the same code differently where xHTML’s problem lies. When xHTML 1.0 is sent as text/html, it is handled as HTML. This means that it has zero user benefits over HTML 4.01.</p>
<p>When sent as application/xhtml+xml, you could use MathML — but — the browsers will also apply draconian error handling. This way users visiting the site will be punished (by not being able to see the site) for mistakes by the creator (which could be the developer, the CMS, the person updating the text or indeed the user her/himself just writing something). Simple things like a misplaced “<code>&amp;</code>” on a page (instead of “<code>&amp;amp;</code>”) will completely shut off a page from its users.</p>
<p>So not only are there no benefits over HTML 4.01 because you have to send Internet Explorer text/html — you do get user-punishing error handling from other browsers if you decide to send to them the application/xhtml+xml mimetype.</p>
<p>No benefits but increased headaches? Mwa, count me out.</p>
<p>Some people might say ‘but xHTML is the future!’ This may well be, but is of little consequence. The future versions of xHTML (1.1 and 2.0) are not backwards compatible with xHTML 1.0, so writing xHTML now gains you little in the future. Furthermore HTML 5 is coming. Who says that can’t be the future?</p>
<p>My recommendations for writing HTML? Use the doctype ‘HTML 4.01 Strict’ and write your code as xHTML compatible as possible. This means self-closing tags in the body, but not in the head.*</p>
<blockquote><p>*Little known fact: It’s actually in the spec that you’re not allowed to self-close the meta or link tags. Quite silly in practical terms, and I would suggest to the HTML 5 people that they change that<sup class='footnote'><a href='#fn-71-1' id='fnref-71-1'>1</a></sup>.</p></blockquote>
</blockquote>
<p>I hope this answers all the questions people have, but if you have any more (or dare to question my arguments!) don’t hesitate to use the comment form accompanying this journal entry.
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-71-1'>And lo and behold <a href="http://wiki.whatwg.org/wiki/FAQ#Should_I_close_empty_elements_with_.2F.3E_or_.3E.3F">they did</a>! In HTML 5 it’s <a href="http://wiki.whatwg.org/wiki/FAQ#Should_I_close_empty_elements_with_.2F.3E_or_.3E.3F">completely up to you whether you self-close tags or not</a>. <span class='footnotereverse'><a href='#fnref-71-1'>↩</a></span></li>
</ol>
</div>
<p><a href="http://james.gameover.com/index.php/2006/why-i-use-html-instead-of-xhtml/" rel="bookmark">Why I use HTML (instead of xHTML)</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 11 September 2006.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to fix your WordPress 2.0.1 feeds</title>
		<link>http://james.gameover.com/index.php/2006/how-to-fix-your-wordpress-201-feeds/</link>
		<comments>http://james.gameover.com/index.php/2006/how-to-fix-your-wordpress-201-feeds/#comments</comments>
		<pubDate>Fri, 10 Mar 2006 06:29:12 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/index.php/2006/how-to-fix-your-wordpress-201-feeds/</guid>
		<description><![CDATA[If, like me, you waited to update your WordPress installation until 2.0.1 came out, you might have noticed that your article feed turned into a comment feed. Which, as we can see from the following picture, is rather detrimental to your visitor figures: It’s worth noting this doesn’t happen to everyone — just to people [...]]]></description>
			<content:encoded><![CDATA[<p>If, like me, you waited to update your WordPress installation until 2.0.1 came out, you might have noticed that your article feed turned into a comment feed. Which, as we can see from the following picture, is rather detrimental to your visitor figures:</p>
<div class="insertimg"><img src="http://aka.gameover.com/zen/doh-the-feed.gif" /></div>
<p>It’s worth noting this doesn’t happen to everyone — just to people who have index.php in front of their permalinks. The fix for this problem is included in 2.0.2, but it’s a bit silly to have to wait until it comes out. Luckily there’s an easy two-step solution to the problem:</p>
<p>1) As per the instructions at <a href="http://core.trac.wordpress.org/ticket/2379">Trac Bug Ticket 2379</a> :</p>
<blockquote><p>Open the file ‘classes.php’ in your wp-includes/ folder. Find line number 1321; it should look like this:</p>
<p><em>// Root<br />
(blah blah)</em></p>
<p><em> // Comments<br />
<strong>$comments_rewrite = $this-&gt;generate_rewrite_rules($this-&gt;root . $this-&gt;comments_base, true, true, true);</strong><br />
$comments_rewrite = apply_filters(‘comments_rewrite_rules’, $comments_rewrite);</em></p>
<p>That first line in the comments section (in bold) needs another ‘, false’ behind it. That means it should end up like so:</p>
<p><em>// Comments<br />
$comments_rewrite = $this-&gt;generate_rewrite_rules($this-&gt;root . $this-&gt;comments_base, true, true, true<strong>, false</strong>);</em></p></blockquote>
<p>2) Now go to your ‘Options’ panel in your WordPress admin centre. Click on the ‘permalinks’ tab. If you’ve chosen the 4th option, copy your custom structure to clipboard (ctrl+c). Select the 1st option. Click ‘update permalink structure’. Now select your original option again. If it the 4th, put your custom structure back in again. Click ‘update permalink structure’ again. Or, because an image speaks a thousand words:</p>
<div class="insertimg"><img src="http://aka.gameover.com/zen/feed-expl.gif" /></div>
<p>That’s all there is to it!</p>
<p><strong>Update:</strong> <a href="http://wordpress.org/download/">WP 2.0.2 is out</a>, and the fix is indeed included. Remember to use <a href="http://codex.wordpress.org/Upgrading_WordPress#Upgrade_2.0.1_to_2.0.2">the special upgrade procedure</a> — it’s a quick delete/move &amp; upload this time!</p>
<p><a href="http://james.gameover.com/index.php/2006/how-to-fix-your-wordpress-201-feeds/" rel="bookmark">How to fix your WordPress 2.0.1 feeds</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 10 March 2006.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elastic, Liquid, Pixel: Explained.</title>
		<link>http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/</link>
		<comments>http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/#comments</comments>
		<pubDate>Sun, 05 Mar 2006 22:18:25 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/index.php/2006/elastic-liquid-pixel-explained/</guid>
		<description><![CDATA[In ‘modern’ web design (as in, the last five years versus the five years before) there are three main ways to define your design. Also called ‘fixed’, the first and most used method uses pixel measurements to define the width (&#38; height) of elements on a page. The most obvious advantage to this method — [...]]]></description>
			<content:encoded><![CDATA[<p>In ‘modern’ web design (as in, the last five years versus the five years before) there are three main ways to define your design.</p>
<p>Also called ‘fixed’, the first and most used method uses pixel measurements to define the width (&amp; height) of elements on a page. The most obvious advantage to this method — and the reason it’s the easiest to get your head around — is that you get pixel perfect results with it. Photos and other fixed elements on your page will always fit, another huge advantage. That’s also its downfall however, as it doesn’t increase in size as text scales, making the defining of a good line-length quite difficult.</p>
<p>Which brings us to the next, most recent, method dubbed ‘elastic’. The crux of this method revolves around using ‘em’ to define (mainly) widths instead of ‘px’. You’ve already guessed of course that ‘px’ stands of pixel — but how is ‘em’ exactly defined? Well, an ‘em’ is the width a normal ‘m’ takes up on the screen. This method has the advantage of scaling along with the text. That means your line-length will always be exactly as you defined it, but, if an included picture were to take up more width than the current line-length, it’d stick out.</p>
<p>Liquid has been going in and out of fashion for a couple of years now. It uses percentages (defined with ‘%’ in one’s code of course) to define the width of elements. I think it was created with the intention of not squandering precious screen real estate, and while it does maximise the use of the screen, it has several flaws. Given that screen sizes can vary a great deal, a designer can never be certain the line-length is anywhere near correct and whether or not photos actually fit (pushing themselves off the screen, or worse, pushing the design off the screen!).</p>
<p>In my next article (not necessarily the next post!) I’ll talk more about handling the downsides of the methods and how a mix of them is often the most effective (and laden with browser flow errors — yikes!).</p>
<p><a href="http://james.gameover.com/index.php/2006/elastic-liquid-pixel-explained/" rel="bookmark">Elastic, Liquid, Pixel: Explained.</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 5 March 2006.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using tables may cause bodily harm</title>
		<link>http://james.gameover.com/index.php/2006/using-tables-may-cause-bodily-harm/</link>
		<comments>http://james.gameover.com/index.php/2006/using-tables-may-cause-bodily-harm/#comments</comments>
		<pubDate>Tue, 31 Jan 2006 14:00:58 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[Hypertext]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/?p=41</guid>
		<description><![CDATA[Go to site. Look at design. Not bad is it? Quite alright. Model’s quite alright too and doesn’t distract from the products too much. Now increase text size. (use ctrl + plus or ctrl + scroll wheel up) Ignoring the fact that most of the text remains at exactly the same size, look what it’s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.globat.com/million/" class="broken_link">Go to site</a>. Look at design. Not bad is it? Quite alright.  Model’s quite alright too and doesn’t distract from the products too much.</p>
<div class="insertimg" style="float:right;margin:0 0 4px 6px;"><img src="http://akaxaka.gameover.com/img/bodily-harm.gif" alt="Bodily Harm" /></div>
<p>Now increase text size. (use <em>ctrl + plus</em> or <em>ctrl + scroll wheel</em> up) Ignoring the fact that most of the text remains at exactly the same size, look what it’s done to the model!</p>
<p>So beware: using tables may cause bodily harm.</p>
<p><a href="http://james.gameover.com/index.php/2006/using-tables-may-cause-bodily-harm/" rel="bookmark">Using tables may cause bodily harm</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 31 January 2006.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSS selectors explained properly</title>
		<link>http://james.gameover.com/index.php/2005/css-selectors-explained-properly/</link>
		<comments>http://james.gameover.com/index.php/2005/css-selectors-explained-properly/#comments</comments>
		<pubDate>Thu, 29 Dec 2005 21:43:28 +0000</pubDate>
		<dc:creator>James John Malcolm</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://akaxaka.gameover.com/?p=32</guid>
		<description><![CDATA[Looking for a good and simple explanation of the currently usable (and a few more) CSS selectors? Roger Johansson has taken the time to compile them all into a 3 part article. I can thoroughly recommend it to people wanting a nice overview of what tools are available to them in Cascading Style Sheets or [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for a good and simple explanation of the currently usable (and a few more) CSS selectors? Roger Johansson has taken the time to compile them all into a 3 part article. I can thoroughly recommend it to people wanting a nice overview of what tools are available to them in Cascading Style Sheets or just want to know what the heck “.new + #important &gt; a:focus:first-letter” means. An oldie but a goody.</p>
<p><a href="http://www.456bereastreet.com/archive/200509/css_21_selectors_part_1/">Roger Johansson’s article over at 456 Bereastreet on CSS 2.1 Selectors (part 1)</a></p>
<p><a href="http://james.gameover.com/index.php/2005/css-selectors-explained-properly/" rel="bookmark">CSS selectors explained properly</a> originally appeared on <a href="http://james.gameover.com">Candy by James</a> on 29 December 2005.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
