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.

How do I make icons for Catagories?

edited October 2010 in Vanilla 2.0 - 2.8
So I have vanilla installed on http://ieatthings.com and it's working great so far.

however, i was wondering if it was at all possible to change the 'categories' field from text, to small rectangular icons, similar to something like this http://forums.somethingawful.com/.

notice those icons on the left next to the subforums? I'd like icons to appear instead of say "general [public]" or "scwvd [public]" both on the right of my threads and on the right hand side of the forum under "categories".

is this possible? if so, let me know!

Comments

  • MarkMark Vanilla Staff
    edited October 2010
    I see you've set up a custom theme already. You should be able to get yourself going by changing the theme file for the categories module.

    Copy /applications/vanilla/views/modules/categories.php to /themes/your_theme_name/views/modules/categories.php

    Then edit the contents however you like. One nice way would be to do it with CSS. You can give the containing LI a class name based on the category url stub. Here's how I'd do it (just the top 19 lines of the file quoted here):
    <?php if (!defined('APPLICATION')) exit();
    $CountDiscussions = 0;
    $CategoryID = isset($this->_Sender->CategoryID) ? $this->_Sender->CategoryID : '';

    if ($this->_CategoryData !== FALSE) {
    foreach ($this->_CategoryData->Result() as $Category) {
    $CountDiscussions = $CountDiscussions + $Category->CountDiscussions;
    }
    $CssClass = $Category->UrlCode;
    ?>
    <div class="Box">
    <h4><?php echo T('Categories'); ?></h4>
    <ul class="PanelInfo">
    <li class="<?php
    echo $CssClass;
    if (!is_numeric($CategoryID))
    echo ' Active';

    ?>"><strong><?php echo Anchor(Gdn_Format::Text(T('All Discussions')), '/discussions'); ?></strong> <?php echo $CountDiscussions; ?></li>
    Then, of course, you'd need to add css to your theme so that it knows what image to load under each category.
Sign In or Register to comment.