01/12/03
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!
6
Tags: 


Previous





Download our vCard
ste said 1831 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! :DJon Hicks said 1831 days ago:
Ah yes, but the feeling of acheivement, having written a script yourself! Its far more satisfying!Matthew Walburn said 1830 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
Jon Hicks said 1830 days ago:
I know what you mean - I'll be fiddlin' an' tweakin' till the day I die...Lars said 1830 days ago:
Well, I'm on WordPress. Can't wait for that script; can you have it ready by Monday? :)
The Scholar said 1829 days ago:
Thanks for the information. Flip-flop definitely seems like a handy tool. Will have to check it out some time.