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.

Alternate Discussion Colors

I'm working on a fairly heavily modified theme for Vanilla and there's something I really don't know enough about the framework to handle. Is it possible for an extension to alternate classes for discussion. Basically you'd have style1 and style2 (probably newstyle1 and newstyle2 for new posts) that would be applied back and forth on discussion. I'm more interested in the actual code to do this as I'll have to apply it differently anyway, but I think the extension would be awesome.

Sorry if I'm not explaining it well.

Comments

  • I think I know what you mean.

    1st post is pink.
    2nd post is blue
    3rd post is pink
    3th post is blue

    Swap post for discussion if you want.

    Is that what you mean?
  • Could you do an if statement so that any even rows would be one colour and any odd rows would be another colour? If that makes any sense whatsoever ;s
  • JoeJoe
    edited August 2006
    The code (the one blizeH suggested) would be something like this:

    $RowCount = 0; $Colour1 = 'ClassOne'; $Colour1 = 'ClassTwo'; $RowColour = ($RowCount % 2) ? $Colour1 : $Colour2; while(--Discussion while statement here--) { // Discussion Code Here $RowColour like: class="$RowColour". $RowCount++ }
    I'll have a look into trying to implement it into Vanilla later.
  • Yeah Joe is on the right track. It's just an issue of finding the remainder to figure out if the discussion row is odd or even. I've done it a hundred times for my own applications, but I'm a little afraid to start messing with the vanilla code as I'm on a deadline and can't really be arsed with breaking the thing.

    Glad some smarter people are interested in this.
  • I would be attempting to do it in a extension instead of a hack. I don't know if it's possible yet though... It might come to editing the framework but that really isn't a good idea.
  • The smallest amount of code needed: [Help] Alternating Row Color in Custom Theme.

    I don't believe an extension is possible. :/
  • JoeJoe
    edited August 2006
    I don't believe an extension is possible. :/
    I think it's looking that way too. That link does everything needed though - you will just going to have to edit the code every time you upgrade Vanilla.
This discussion has been closed.