Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Alternate 2 colours in a discussion

edited July 2006 in Vanilla 1.0 Help
Hi all, firstly it's my first post so hi everyone :) I have begun integrating vanilla onto my website but there was one small aesthetic problem i was wondering if any of you could help me with. I saw on a vanilla forum somewhere that in each discussion, each post alternated between 2 colours, i.e. yellow white yellow white etc. How would i go about implementing this? Many thanks for your time, Cheers.

Comments

  • Options
    There's a category colour add-on that colours discussions in the discussion list according to category and the discussions are classed with read, not read, contains new replies etc. so that you can colour-code according to these criteria, but I don't think there's the even-odd class in there. Using even-odd on the discussion-list will subvert that functionality, or at least make it complex. I can imagine it working better for the comments personally.

    Anyway, you could achieve it by modifying that part of the theme that outputs the discussion list (make a copy of that file and put it in a new folder of your own in /themes), or you could use javascript to loop through the discussions in the list once it has been output and style them alternately, for instance using the splintered striper script.
  • Options
    Thanks for that, could anyone please tell me which .php file i would need to modify - sorry for being lame!
  • Options
    shaun inman did a imilar thing with punbb. check out his site for how he did it. http://www.shauninman.com/plete/
  • Options
    Yes, shaun inman's method would work from within vanilla. You'd need to apply it to themes/vanilla/comments.php.

    I'm no expert at this, but I think the equivalent while loop begins around line 43 and looking a little further down you can see where $CommentClass is being defined for whispered or hidden comments. I guess that is where you'd enter shaun inman's last bit and adjust it to set (append) $CommentClass to "alt" for example.

    Then you should be able to style the comments with a class="alt" (or whatever you choose there).

    As I said, work on a copy of comments.php in your own folder e.g./themes/yourfolder/. Likewise, copy vanilla.css to themes/yourfolder/styles/default/vanilla.css and add the styles you've declared for the alternate background. Then select your new theme from the settings page.
  • Options
    Ok great, ill have a look tonight, or maybe tomorrow morning.... depending on the hangover :)
This discussion has been closed.