<?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>Storm Development Blog &#187; Code</title>
	<atom:link href="http://demo.storm-consultancy.com/blog/development/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://demo.storm-consultancy.com/blog/development</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 26 Feb 2010 13:36:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Archive of Related Entries with Movable Type</title>
		<link>http://demo.storm-consultancy.com/blog/development/code-snippets/archive-of-related-entries-with-movable-type/</link>
		<comments>http://demo.storm-consultancy.com/blog/development/code-snippets/archive-of-related-entries-with-movable-type/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 14:40:25 +0000</pubDate>
		<dc:creator>Adam Pope</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.izonedesign.co.uk/blog/movable-type/archive-of-related-entries-with-movable-type/</guid>
		<description><![CDATA[Recently, I have been working on a Movable Type based website for monthly research data.  We found that we needed to create a sidebar module displaying monthly entries grouped by year.  After some head scratching I came up with the following MT4 code.

&#60;MTSetVarBlock name="category"&#62;&#60;MTEntryCategory&#62;&#60;/MTSetVarBlock&#62;

&#60;h3&#62;Historic Data&#60;/h3&#62;

&#60;$MTSetVar name="year" value="0"$&#62;

&#60;MTEntries sort_order="descend" category="$category"&#62;

&#60;MTIfNotEqual a="[MTEntryDate format='%Y']" b="[MTGetVar name='year']"&#62;
  [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I have been working on a Movable Type based website for monthly research data.  We found that we needed to create a sidebar module displaying monthly entries grouped by year.  After some head scratching I came up with the following MT4 code.</p>
<p><span id="more-25"></span></p>
<pre class="brush: plain">&lt;MTSetVarBlock name="category"&gt;&lt;MTEntryCategory&gt;&lt;/MTSetVarBlock&gt;

&lt;h3&gt;Historic Data&lt;/h3&gt;

&lt;$MTSetVar name="year" value="0"$&gt;

&lt;MTEntries sort_order="descend" category="$category"&gt;

&lt;MTIfNotEqual a="[MTEntryDate format='%Y']" b="[MTGetVar name='year']"&gt;
  &lt;MTIfNotEqual a="[MTGetVar name='year']" b="0"&gt;&lt;/ul&gt;&lt;/MTIfNotEqual&gt;
  &lt;h4&gt;&lt;$MTEntryDate format="%Y"$&gt;&lt;/h4&gt;&lt;ul&gt;
  &lt;MTSetVarBlock name="year"&gt;&lt;$MTEntryDate format="%Y"$&gt;&lt;/MTSetVarBlock&gt;
&lt;/MTIfNotEqual&gt;

&lt;li&gt;&lt;a href="&lt;$MTEntryPermalink$&gt;"&gt;&lt;$MTEntryTitle$&gt;&lt;/a&gt;&lt;/li&gt;

&lt;/MTEntries&gt;</pre>
<p>This code sets a variable, $category, containing the name of the category associated with the current entry.  It then selects all the entries in this category in descending date order.  A $year variable then tracks the year of the last entry, printing out a heading when the year changes.</p>


<div class="taggington"><p><!--<img src="/blog/wp-content/themes/stormblog/images/tag.gif" alt="tag"/>&nbsp; -->Tagged in: &nbsp;<a href="http://demo.storm-consultancy.com/blog/development/tag/code/" rel="tag">Code</a>&nbsp;&nbsp; <a href="http://demo.storm-consultancy.com/blog/development/tag/tutorials/" rel="tag">Tutorials</a></p></div><div class="relatedpostplugin">
<h3>You may also be interested in...</h3>
<div class="relatedlinks">
<a href="http://demo.storm-consultancy.com/blog/development/code-snippets/scheduling-a-process-with-cron-and-crontab/" rel="bookmark">Scheduling a Process with Cron and Cront...</a><!-- (3.89986)--><br /> 
<a href="http://demo.storm-consultancy.com/blog/development/code-snippets/perl-sorting-an-array-of-hashes/" rel="bookmark">Perl: Sorting an Array of Hashes</a><!-- (3.59594)--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://demo.storm-consultancy.com/blog/development/code-snippets/archive-of-related-entries-with-movable-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.261 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-10 09:39:57 -->
