Jump to content
NJC

Commenting: How can I shade alternate comments

Recommended Posts

I would like to change the background color of alternate comments to a post. This way I can differentiate each comment, making it easier for the reader.Cheers

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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;}

Share this post


Link to post
Share on other sites

thanks justsomeguy.i am just about getting the hang of CSS. Forgive the ignorance, but I would not have a clue where to start with the scripting code. Appreciate your helping nontheless!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Well, you cant post comments without SQL/php, or some other server language.. lol. Do what someguy said..

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

did you code this blog manualy or download it. You see to leave a comment on the site it would require either asp php or sql or a combination. So what they are trying to say isYou will probably have to edit the code

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...