This Space Intentionally Left Blank

16 Prairial CCXII (June 3, 2004)

(System Stuff) Thus We Play The Fools With Time

The list of monthly archives was getting a little long, so I decided to do something about them.  Basically, I looked at the output of Tunes2HTML, a perl script that makes a webpage out of your iPod database, and adapted the code used to cascade artists, albums, and songs into something usable for my purposes.

Those who want to know how I did it can find the info in the extended entry.  Those who just care about points can make a guess at this 2 point title.

Ok, here goes:

1.  First off, you'll need the Compare and SetVarBlock plugins.  Install them, and then continue on to the next step.

2.  Now that you have the plugins installed, insert the following snippet of JavaScript onto any pages you want to use this feature:

<script language="javascript" type="text/javascript">

var downImg = new Image();
downImg.src = "/img/tmpl/arrow-down.png"

var rightImg = new Image();
rightImg.src = "/img/tmpl/arrow-right.png"

function showYear( _yearId, _imgId ) {
	var thisYear = document.getElementById( _yearId );
	var thisImg = document.getElementById( _imgId );
	if ( thisYear.style.display == "none") {
		thisYear.style.display = "";
		thisImg.src = downImg.src;
		}
	else {
		thisYear.style.display = "none";
		thisImg.src = rightImg.src;
		}
}
</script>

I presonally recommend creating a new template module and using MovableType's include tag to include it on the pages, like so: <$MTInclude module="Script Name"$>

3.  Now, you'll want to go to the section where you are creating your archive list and replace the MTArchiveList section with this tidbit:

<MTSetVar name="year" value="0">

<MTArchiveList archive_type="Monthly">

<MTIfNotEqual a="[MTArchiveDate format='%Y']" b="[MTGetVar name='year']" numeric="1">
<MTIfNotEqual a="0" b="[MTGetVar name='year']" numeric="1">
</div>
</MTIfNotEqual>

<MTSetVarBlock name="year"><$MTArchiveDate format="%Y"$></MTSetVarBlock>
<a href="javascript:showYear('<$MTGetVar name="year"$>','img<$MTGetVar name="year"$>');" style="text-decoration:none">
<img id="img<$MTGetVar name="year"$>" src="/img/tmpl/arrow-right.png" /><$MTGetVar name="year"$>:<br />
</a>
<div id="<$MTGetVar name="year"$ >" style="position:relative;left:+15px;display:none">
</MTIfNotEqual>

<a href="<$MTArchiveLink$>"><$MTArchiveDate format="%B"$></a><br />
</MTArchiveList>

4.  Change the references to the images in both the script and template code to point to the images you want to use, and you're done.  Finally, please remember to share and enjoy!™

Posted by g026r at 02:42
Comments

I'd like to point out I read the extended entry.  Because there is more to life than points.

Theres also code.

Posted by Derek at 16 Prairial CCXII 08:40 (2004/06/03)

This is seriously fantastic technology.

Posted by peter at 17 Prairial CCXII 03:33 (2004/06/04)

The title's from Shakespeare's King Henry IV, pt. II, act ii.

For some reason the code in the extended entry spills over into the yellow area in Safari - just thought you might like to know that.

Posted by Andrew H. at 17 Prairial CCXII 13:44 (2004/06/04)

It's caused by a combination of <pre> tags and one particular line that is too long.  I just can't be bothered to fix it.

Siteicon Posted by g026r at 17 Prairial CCXII 13:52 (2004/06/04) PGP

Question.  How do you have my little kk icon?  I lost it when punpkin was redone, and I want it back.

I'm to lazy to gimp it up myself again.

Posted by Derek at 18 Prairial CCXII 12:06 (2004/06/05)

I'd check your cache, as I don't actually have your KK icon.  Unfortunately, how that particular plugin that displays the icons works is by putting a link to the favicon stored remotely on the commentor's site.

Siteicon Posted by g026r at 18 Prairial CCXII 14:14 (2004/06/05) PGP

Hmm.  I may just have to gimp it up.  By god, I'm lazy.

Posted by Derek at 18 Prairial CCXII 16:31 (2004/06/05)

Just as a side note:  do you want me to change all references to http://pumpkin.ath.cx/~derek/ in the comments database to point to http://dirkdeadeye.ath.cx/~derek/ ?

Siteicon Posted by g026r at 18 Prairial CCXII 16:47 (2004/06/05) PGP
Post a comment







Past Entries

Past Entries