Recently in MT Style Tweaks Category

Alternating Comment Styles with Smarty

[TESTING]

So you want to create alternating background colors for your (dynamically published) comments? I just came across a sweet little *gem in Hacking Movable Type about Smarty's "cycle" function... worth the price of the book, IMO. But, I digress. :-)

If you are using dynamic publishing for your individual entry archives, you can very simply edit your template to create alternating comment background colors (or any alternating style) with Smarty's "cycle" function.

The "cycle" funtion will, as the name implies, cycle through a list of values each time it is used within a loop. This is a perfect little solution for the task at hand. An added bonus is that it can cycle through more than two values, allowing you to alternate two, three or more styles. In MT's dynamic archives templates, the smarty cycle tag is written with double brackets {{cycle values="x,y,z"}}, using whatever values you want (numerals, words, etc). Here is one way to use it in your (MT3.2) individual entry archive template:

3-column archive templates

1)  copy main index template from

<div id=container>
to
<div class=content>
2)  in individual archive template paste (what you just copied above), replacing from
<div id=container>
to
<div class=content>
3)  cut
<br style="clear: both;" />
from beneath/end of "FORGET INFO" code and paste
<br style="clear: both;" />
under/at end of (FINISH THIS THOUGHT! brain fart... sorry!)

That is all fine and dandy as long as you have comments open. If comments are closed you need to clear the floats or your 3 columns will be differing lengths. Not a pretty sight! So...
4)  paste this code:

<MTElse> <br style="clear: both;" /> </MTElse>

just above these closing tags near bottom of page (using tags for 3.1x or earlier):

</MTEntryIfCommentsOpen> </MTEntryIfAllowComments>

or if you're using 3.2 tags clear goes BETWEEN these tags like this:

</MTIfCommentsActive> <MTElse> <br style="clear: both;" /> </MTElse> </MTIfCommentsAccepted>

This is what worked for me. Hope it works for you.

input styles

* this style requires small hack to mt's search_templates search field in form: input id="search" */

.content form input#search { background-color: #fcebd8; }
.link-note form input#search { background-color: #fcebd8; }
.link-note form input#input { background-color: #fcebd8; }

displaying code in entries

There are several ways to suitably display code in MT entries. If you do not encode your code (replace html entities) it will become the very code you're attempting to display. (out of espresso beans this morning, brain is fuzzy, sorry for the convoluted verbiage)

Rather than doing the "textarea" thing (google for more info on that), I prefer to simply run the code through a web utility that replaces the html entities so my code will display properly. I then surround my newly encoded code with blockquote tags and I'm done.

There are numerous free encoding tools on the web. My favorite (because I could install it on my own site) is SimpleCode by Dan at SimpleBits. You might also check out