October 2005 Archives

Alternating Comment Styles with Smarty

| No Comments

[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:

Happy 4th Birthday to Movable Type!

Congratulations to Ben, Mena and the 6A team AND to the awesome Movable Type user community. The blogging world is a richer place thanks to your efforts!

I became an MT convert about three years ago and will always fondly remember my first installation (pathetic, I know) -- once I finally decided to take the leap to MT, it took another three days just making the decision to install it myself. Sweating bullets (on a cold winter night!), I proceeded with fear and trepidation through the installation process. Although the installation was straightforward, I entered into it with a deficit of knowledge and experience in such matters. Thus ensued a bit of bumbling, a fair amount of googling and finally... victory triumphant! I had a shiny new blog powered by Movable Type v2.51 and my first introduction to the mysterious Melody Nelson. ;-)

Since then Movable Type has become a family affair here, with each of my daughters, my son-in-law and my grandbabies (with their mama's help) now blogging with MT on their own sites... sharing their stories, photos, hobbies, and passions. I even use MT as part of our homeschooling studies with my teenage girls... teaching them some basic html, css, and MT template tweaking skills, as well as giving them a medium for practicing their writing and communication skills. My personal favorite MT project is an online "journal" created for a volunteer group of young historic interpreters who portray 18th century Virginians at local historic sites (such as the childhood home of George Washington, etc). Although sprinkled with some factual details, the journal entries are the fictional accounts of the kids' 18th century personas. I am presently working on redesigning their entire site to be powered by MT, so that these young historic preservationists can easily manage their own website. I will also say that, in addition to my own blogging, learning the inner workings of Movable Type over the past few years has been a therapeutic pursuit and a (mostly! LOL) healthy diversion through some challenging personal times, occasional obsessing over tweaks and hacks notwithstanding. ;-)

Again, congrats to SixApart for a wonderful product and for cultivating an equally great community of users. I look forward to celebrating many more MT "birthdays" with you!

About this Archive

This page is an archive of entries from October 2005 listed from newest to oldest.

August 2005 is the previous archive.

November 2006 is the next archive.

Find recent content on the main index or look in the archives to find all content.