Jump to content

Commenting: How can I shade alternate comments


NJC
 Share

Recommended Posts

Once I create a post in my blog. People leave comments.It is these comments that I would like to differentiate. Like shade each alternate comment, Thus eg: 1st comment is shaded, the next unshaded, the following shaded and so on.Something like this: TechCrunch

Link to comment
Share on other sites

Someone else may be able to give you an example on how to do that with CSS, but every time I've done that myself I've just done it in the scripting code. That is, when I am writing out the comments, I have a variable to say whether or not to color the current comment, and I reverse that variable every time. So something like this (in PHP):

$result = db_query("SELECT * FROM comments");$highlight = false;while ($row = db_fetch_assoc($result)){  if ($highlight)    echo "<tr class=\"color2\">";  else    echo "<tr class=\"color1\">";  ...  display post  ...  $highlight = !$highlight;}

Link to comment
Share on other sites

It shouldn't be all that hard. The first step is to browse to the comments page, and take a look at the URL. It probably points to either an ASP or a PHP page. Figure out which page it is, and we can edit that page to do this. I don't think CSS can do this, but I may be wrong.

Link to comment
Share on other sites

Thank you for your response sjr.Maybe I am not making myself clear in what my query is.I run a blog (a community blog) @ Musoma. This is a community blog.An entry has been created @ Sunday May 14, 2006You will see that there are about 15 comments to that particular entry.What I would like to 'try' and do is to somehow separate each comment, so that the comments do not look all jumbled up. Now, for some reason that appears to be humorous, so be it.

Link to comment
Share on other sites

What needs to happen is that the application - Movable Type 3.2 according to your meta data - has to alternate the CSS class of each comment. "Alternating Commments"This is done with the server-side codeing, not in CSS. However, the styles are defined in the CSS file.Looking around the Movable Type Templates, particularly the comment listing template, it looks like Movable Type does not alternate its comments.So now I must recommend WordPress for your weblog. Not only does WordPress already alternate comments and has themes to utilize the feature, but WordPress is Open Source. That means that if there is a feature you find WP to lack, you can add it in with either the program itself or as a plug-in.Transitions like this are risky and sometimes intimidating, but others have done it, so why not give it some thought?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...