The Hickensian

Flip Flop

A few folks have asked me how I created the alternating background colours in the comments sections. I use a Movable Type plug-in called ‘Flip Flop’, written by a chap called Gavin Estey. I’d been wanting to use this for a while, and finally got around to implementing it.

All you need to do is create the 2 alternating styles (an odd and an even) in your css, and then put the following code into your MT template. In this simplified example, I’ve used ‘green’ and ‘white’ as my 2 options.

CSS:

/* MT Flip Flop styles */
.green {
padding: 8px;
background: #EEF7DD;
}
.white {
padding: 8px;
background: #fff;
}

Movable Type:


<MTComments>
<div class="<$MTFlipFlop odd="green" even="white"$>">
<$MTCommentBody$>
</div>
</MTComments>

The Flip Flop plug-in then decides which style it needs to use. Thanks Gavin!

Comments | RSS

No.1

ste said 2042 days ago:

Wow, nifty - and to think I went to all the trouble to write a little PHP snippet to manage that in an older version of the site. I should look into that, though - thanks for sharing! :D
No.2

Jon Hicks said 2042 days ago:

Ah yes, but the feeling of acheivement, having written a script yourself! Its far more satisfying!
No.3

Matthew Walburn said 2041 days ago:

Excellent! This is just the thing I've been looking for to spice up my blog a little. (not that that process ever stops!)

-Matthew
No.4

Jon Hicks said 2041 days ago:

I know what you mean - I'll be fiddlin' an' tweakin' till the day I die...
No.5

Lars said 2041 days ago:

Ah yes, but the feeling of acheivement, having written a script yourself! Its far more satisfying!



Well, I'm on WordPress. Can't wait for that script; can you have it ready by Monday? :)

No.6

The Scholar said 2040 days ago:

Thanks for the information. Flip-flop definitely seems like a handy tool. Will have to check it out some time.

Elsewhere

The Rissington Podcast - weekly shenanigans with Jon Oxton Hicksmade - unique handmade goods by Leigh Hicks

Hickr | RSS