Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Alternating background color for discussion listing [its working now...]

edited January 2011 in Vanilla 2.0 - 2.8

I'm creating a theme to suit my new site.
Is it possible to assign alternative background color for discussion listing?

I have checked the output in firebug got the following markup
<ol id="Discussions"> <li class="Discussion Read NoNewComments NoReplies Category_2" id="Discussion_2"><ul> <li class="DiscussionType"> <span>Discussion Type</span> </li> <ol/>

How can i add one more custom class to

<li class="Discussion Read NoNewComments NoReplies Category_2" id="Discussion_2">


  • Options
    Another option would be to use CSS and have

    .Discussion:nth-child(2n) {}
    however this will only work in newer browsers not ie6.
  • Options
    MarkMark Vanilla Staff
    In your plugin (or theme hooks), do this:
    public function DiscussionsController_BeforeDiscussionName_Handler($Sender) {
    $CssClass = GetValue('CssClass', $Sender->EventArguments, '');
    $Sender->EventArguments['CssClass'] = $CssClass .= ' SomeNewClass';
  • Options
    Thank you very much for the reply

    I'm new to vanilla. I created a new theme my coping the existing vanilla theme and renaming it. and i have made changes to default css files .

    I want to display the listing discussion in alternating color.
    Is there a detailed document about creating a new theme from the scratch.

    sorry for my poor english...
  • Options
    I did the following ..

    1.copy and pasted discussion.php in my new theme folder. created mark up for listing discussion.

    2.declared a variable and for each discussion the value of the variable keep changing.
    ie 1 or 2 .

    3. added necessary class in vanilla.css

    4.check the value of the variable and determine the class to be used.

    And its working.....
Sign In or Register to comment.