
Using TypePad to Tabulate Data
December 28, 2006
This article reprinted from the the TypePad Hacks Weblog. The original article can be found online:
https://www.typepadhacks.org/2006/12/using_typepad_t.html
© 2008, John T Unger
Debra Hamel notified me of a really interesting
new hack she came up which allows you to use TypePad's database
structure to tabulate data from multiple entries on a single page. Deb
used it to collect daily and weekly puzzle scores.
I could also see it being useful for tracking various metrics such as
stock prices, links, Alexa ratings, weather data… and so on. Anything
that you post about frequently and would like to display in a
constantly updated table rather than as a page of archives.
I've modified her instructions somewhat to make the hack a little easier to follow as a generic concept. Her tutorial
is also highly recommended as it walks you through the process in a bit
more of a narrative format with a single concrete example.
- Create a new category that will be used to identify posts containing the data you wish to collect. You'll need to click Save and Republish at the bottom of the page.
- Go to the Design tab for your blog.
- Click on the link for your Main Index Template and copy the code. Return to your Design tab.
- Click on Create new index template.
There are three fields for you to work with. The Template Body field is where you will put your code. The Template Name can be anything that helps you remember which template it is, such as Recent Comments. The Output File is the name of the file that will be created. The output file name is used in the URL for the page: if you name it comment_archive.html it will generate a page with the URL http://example.typepad.com/weblog/comment_archive.html. You must remember to include the file extension (.html).
- Paste the code you copied from your Main Index Template into the Template Body field.
- Scroll down to the title tag and change it to show whatever title you would like displayed in the top of the browser.
- Scroll down until you see the line that brings in your posts:
<$MTInclude module="entry-list"$>
Replace it with the following code:
(items marked in bold require modification)<h3 class="entry-header">Title for Data</h3>
<p>Description of Data.</p>
<table cellpadding="20" cellspacing="0" border="0">
<tr><td valign="top">
<div align="center"><b>Data Header</b></div>
<br />
<table cellpadding="0" cellspacing="0" border="0"><tr><td>
<MTEntries category="your new category">
<div align="right"><$MTEntryDate format="%A, %b %e, %Y"$>: <b><$MTEntryKeywords$></b><br /></div>
</MTEntries>
</td></tr></table>
</td></tr></table> - Click Save. Click Publish.
- Go back through your archives and apply the new category to all previous posts containing your data set. Read the next step before you do this.
- As you assign the new category to each post, copy the data you want into the keyword field of each post. (Deb copied her score… if you were compiling weather data, you'd copy the temperature, dew point, etc.).
- Place a link to the page in one of your TypeLists so that people can find it.
Options:
There are a number of variables you can change to customize this hack to meet your needs.
The code that automatically calls up data from the keyword in a named category looks like this:
<MTEntries category="your new category">
<div align="right"><$MTEntryDate format="%A, %b %e,
%Y"$>:
<b><$MTEntryKeywords$></b><br />
The rest is just formatting which you can edit to your heart's content. Debra, for example, has two columns in her example. These are created by the same means, except that the category is different. As long as the data points are being pulled in from different posts, I can't think of why you couldn't have as many categories and columns as you need.
You can add images and text or apply CSS or HTML to the page you create, of course.
More Like This: Advanced Templates , Blog Tools , Hacks for Categories
Debra Hamel says:
Thanks for the mention, John!
Posted: Dec 28, 2006 5:18:38 PM