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.

Color Categories

edited June 2006 in Vanilla 1.0 Help
Is there a way to to apply colors to categories? I'd like each discussion of the category to have it's own panel color, before and after being viewed. Hopefully these colors could appear in the full discussions list, and the categories list too. I guess categories list would be seperate. I'm not a code monkey and don't know where to start. Help please.


  • Options
    i looked at doing this a while back, but never really followed through - there are class names defined in the html but not really used by default (as far as i can tell) that would allow you to specify distinct styles for posts of a given category.

    Category_1, Category_2, etc.
  • Options
    lechlech Chicagoland
    You can't really control it in the sense of before and after view in a global scope (ie: I just read all threads in this category) and have it change. But you can obviously alter the link/bg color if you entered that category recently, the category classes are primarily used if you're blocking/subscribing to threads in the particular category.
  • Options
    Take a look at themes/discussions.php and themes/discussion.php

    If you make your own folder in /themes, then copy one or both of those files into it, you can experiment with changing them. The file discussion.php determines how the discussions are listed out.

    I'd guess you can pull the value of the CategoryID and apply it to the discussion list as a class, something along the lines of class="category_'.$Discussion->CategoryID.'" You can see how its employed in that file, for instance in generating the URL for the category.

    You could then style .category_1 using CSS and in combination with NewComments and NoNewComments get your two states.

    EDIT: Just perusing the HTML soruce of this page I can see that the categoryID is already passed into a class, e.g.

    <li id="Discussion_2282" class="Discussion Read NewComments Category_10"> or <li id="Discussion_533" class="Discussion Closed Sticky Read NoNewComments NoReplies Category_16">

    You should be able style Category_.. and NoNewComments / NewComments to get what you want
  • Options
    oh, so i'll have to upgrade from 0.9 first. i'm pretty clueless with that php either way, but thank you
  • Options
    ah right, forgot to say that was for one-oh. I don't have that much idea about PHP either, but if you look at the file you'll see mark has chosen sensible names for things so that it is almost human-readable :-)
  • Options
    I'm currently making a add-on to address this, if anyone would like to help me, i would be very appreciative because i can get busy and forget even good projects like this one
  • Options
    I can't seem to change the colours in CSS, or with the extension (which doesn't appear to work at all). Even if I change every colour function in CSS the discussion backgrounds come out the same? Confusion
This discussion has been closed.