« How To Add Expanding-Collapsing Menus With Subcategories to your TypePad Blog | Main | Free Site Stats from FeedBurner: My New Favorite Stats Package »

John T. Unger

Using TypePad to Tabulate Data

John T. Unger December 28, 2006

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.

  1. 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.
  2. Go to the Design tab for your blog.
  3. Click on the link for your Main Index Template and copy the code. Return to your Design tab.
  4. 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).

  5. Paste the code you copied from your Main Index Template into the Template Body field.
  6. Scroll down to the title tag and change it to show whatever title you would like displayed in the top of the browser.
  7. 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"$>:&nbsp;&nbsp; <b><$MTEntryKeywords$></b><br /></div>
    </MTEntries>
    </td></tr></table>
    </td></tr></table>
  8. Click Save. Click Publish.
  9. 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.
  10. 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.).
  11. 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"$>:&nbsp;&nbsp;
<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

Comments

Debra Hamel says:

Thanks for the mention, John!

The comments to this entry are closed.

TrackBack

TrackBack URL for this entry:
https://www.typepad.com/services/trackback/6a00d8341c4fdf53ef00d834d36e9e53ef

Listed below are links to weblogs that reference Using TypePad to Tabulate Data:

typepad hacks is a typepad featured weblog typepad hacks is listed on Alltop social media

Subscribe

Email RSS Comments  
Subscribe to TypePad Hacks with email Read TypePad Hacks posts via RSS Join the conversation at TypePad Hacks via RSS (comments feed) subscriber count

Search

Socialize

Twitter Logo
    follow typepadhacks on twitter

    Read and reply to the 100 most recent comments at the TypePad Hacks Community Page


    Grazr

    Colophon

    Powered by TypePad
    Member since 03/2005

    TypePad Status

    Creative Commons License