Fork me on GitHub
Current releases are 2.1.3 (9 Sept 2014) and 2.0.18.13 (5 Aug 2014)

Ready for 2.1? Find out if your plugins are compatible. 2.0 will no longer be updated after Dec 2014.

how to remove the thread counts in category side panel?

shozen1shozen1 New
edited January 2012 in Vanilla 2.0 Help

is it possible to remove the thread counts in the category side panel? thanks

Tagged:

Best Answer

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... Moderator
    Answer ✓

    @shozen1

    In addition to Firebug in Firefox, someone on here recommended Agent Ransack (I'm on Windows) or Grep for command line searching.

    Using Firebug it shows that the relevant element is PanelCategories.

    Searching for"PanelCategories" in Agent Ransack shows that it occurs in

    vanilla\applications\vanilla\views\modules\categories.php

    I'm assuming it would be this line

    <span class="Count"><?php echo number_format($CountDiscussions); ?>

    which you would need to edit.

Answers

  • erm thanks @Aolee, but I was hoping someone could show me what the code looks like etc :)

  • shozen1shozen1 New
    edited January 2012

    Let me explain. I would like to replace the post count in the category view on the sidepanel with a small image to represent the category. I can only find the styling for post count in /applications/dashboard/design/style.css which just takes away highlighting but doesn't remove the post count completely.

  • @whu606 - thank you so much.

    And to further clarify, this line is for all discussions

    <?php echo number_format($CountDiscussions); ?>

    and this line is for custom categories below all discussions

    '.number_format($Category->CountAllDiscussions).'

  • shozen1shozen1 New
    edited January 2012

    @whu606

    I have got this to 'work' as I wanted, but I am now receiving errors in my server log related to the file: vanilla\applications\vanilla\views\modules\categories.php below is a snippet of lines 37 and 38 where the error is located somewhere and as I can't read PHP very well, its difficult to see where it is.

    error log: PHP Parse error: syntax error, unexpected ';' on line 37 error log: PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' on line 38

    line 37

    echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong')

    line 38

    .'<span class="Count"></span>';

  • hbfhbf wiki guy? MVP

    shozen1 said: @whu606

    I have got this to 'work' as I wanted, but I am now receiving errors in my server log related to the file: vanilla\applications\vanilla\views\modules\categories.php below is a snippet of lines 37 and 38 where the error is located somewhere and as I can't read PHP very well, its difficult to see where it is.

    error log: PHP Parse error: syntax error, unexpected ';' on line 37 error log: PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' on line 38

    line 37

    echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong')

    line 38

    .'<span class="Count"></span>';

    get rid of the line break between lines 37 & 38. It's really just one line.

  • shozen1shozen1 New
    edited January 2012

    @hbf

    Forgive my ignorance but I dont think there is a line break between 37 and 38, unless you mean bring the } bracket up (line 38) to the same line as the rest of the code on line 37?

            line 37 echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong')
                                .'<span class="Count"></span>';
            line 38         }`
    
  • hbfhbf wiki guy? MVP
    edited January 2012

    shozen1 said: @hbf

    Forgive my ignorance but I dont think there is a line break between 37 and 38, unless you mean bring the } bracket up (line 38) to the same line as the rest of the code on line 37?

    line 37 echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong') .''; line 38 }`

    oh, sorry i thought

     .'< span class="Count">'; 

    was on line 38.

    not sure why you have a line break between 'strong') and .'<span

    you need to provide little more of the code to know where you are missing a bracket or semi-colon. maybe post the whole function.

  • shozen1shozen1 New
    edited January 2012

    Sorry about this, I cant remember how I got the code to display with numbers again!? here is the whole of the code, line 38 is near the bottom you can see its the only line with just a } bracket on it.

    <?php if (!defined('APPLICATION')) exit();
    $CountDiscussions = 0;
    $CategoryID = isset($this->_Sender->CategoryID) ? $this->_Sender->CategoryID : '';
    
    if ($this->Data !== FALSE) {
       foreach ($this->Data->Result() as $Category) {
          $CountDiscussions = $CountDiscussions + $Category->CountDiscussions;
       }
       ?>
    <div class="Box BoxCategories">
       <h4><?php echo Anchor(T('Categories'), 'categories/all'); ?></h4>
       <ul class="PanelInfo PanelCategories">
          <li<?php
          if (!is_numeric($CategoryID))
             echo ' class="Active"';
    
          ?>><span><strong><?php echo Anchor(Gdn_Format::Text(T('All Discussions')), '/discussions'); ?></strong><span class="Count"></span></span></li>
    <?php
       $MaxDepth = C('Vanilla.Categories.MaxDisplayDepth');
       $DoHeadings = C('Vanilla.Categories.DoHeadings');
    
       foreach ($this->Data->Result() as $Category) {
          if ($Category->CategoryID < 0 || $MaxDepth > 0 && $Category->Depth > $MaxDepth)
             continue;
    
          if ($DoHeadings && $Category->Depth == 1)
             $CssClass = 'Heading';
          else
             $CssClass = 'Depth'.$Category->Depth.($CategoryID == $Category->CategoryID ? ' Active' : '');
    
          echo '<li class="'.$CssClass.'">';
    
          if ($DoHeadings && $Category->Depth == 1) {
             echo Gdn_Format::Text($Category->Name);
          } else {
             echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong')
                .'<span class="Count"></span>';
                }
          echo "</li>\n";
       }
    ?>
       </ul>
    </div>
       <?php
    }
    
  • hbfhbf wiki guy? MVP

    try just getting rid of the carriage return after 'strong')

    it looks like everything is closed properly.

    what's the purpose of the empty span class="count"? seems unnecesarry.

    You could probably just get rid of that line and terminate line 36 with a semi-colon.

  • shozen1shozen1 New
    edited January 2012

    by carriage you mean the ' ' empty spaces at the start of the line?

    the span class is doing its job by styling the categories section with a grey rectangle where the post count would have been. (the code I removed originally to get the error)

    thank you for your continued patience!

  • hbfhbf wiki guy? MVP

    shozen1 said: by carriage you mean the ' ' empty spaces at the start of the line?

    the span is doing its job by styling the categories section with a grey rectangle where the post count would have been. (the code I removed originally to get the error)

    thank you for your continued patience!

    all the empty spaces and the new line (the result of hitting 'enter' on the keyboard) make it show as one line.

    I'm just surprised you want the grey box without the number in it.

  • hbfhbf wiki guy? MVP

    the CR and white space shouldn't matter.... the parser is supposed to ignore that, but i'm trying to rule out the simplest thing first.

  • ok so now it looks like this

             echo Wrap(Anchor(($Category->Depth > 1 ? '↳ ' : '').Gdn_Format::Text($Category->Name), '/categories/'.rawurlencode($Category->UrlCode)), 'strong')
                .'<span class="Count"></span>';}
          echo "</li>\n";
       }
    ?>
    

    the reason for the grey box without the number in it http://goo.gl/AwhTP - will give you a better idea. I think it suits the forum, criticism welcome though!

  • shozen1shozen1 New
    edited January 2012

    here is the error log if that helps:

    2:37] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:13:01] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:13:02] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:13:50] PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 38 [28-Jan-2012 03:13:54] PHP Parse error: syntax error, unexpected '}', expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 38 [28-Jan-2012 03:14:12] PHP Parse error: syntax error, unexpected ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:14:17] PHP Parse error: syntax error, unexpected ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:14:20] PHP Parse error: syntax error, unexpected ';' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:16:43] PHP Parse error: syntax error, unexpected '}' in /applications/vanilla/views/modules/categories.php on line 40 [28-Jan-2012 03:16:48] PHP Parse error: syntax error, unexpected '}' in /applications/vanilla/views/modules/categories.php on line 40 [28-Jan-2012 03:16:50] PHP Parse error: syntax error, unexpected '}' in /applications/vanilla/views/modules/categories.php on line 40 [28-Jan-2012 03:16:58] PHP Parse error: syntax error, unexpected '}' in /applications/vanilla/views/modules/categories.php on line 40 [28-Jan-2012 03:20:20] PHP Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '{' or '$' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:20:35] PHP Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '{' or '$' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:20:46] PHP Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '{' or '$' in /applications/vanilla/views/modules/categories.php on line 37 [28-Jan-2012 03:21:15] PHP Parse error: syntax error, unexpected '(', expecting ',' or ';' in /applications/vanilla/views/modules/categories.php on line 37

  • hbfhbf wiki guy? MVP

    ok.. i'll look into it a bit, looks like you are missing a parameter for one of the functions called in that line. my son just woke up so i can't look into it right now.

  • whu606 said: @shozen1

    In addition to Firebug in Firefox, someone on here recommended Agent Ransack (I'm on Windows) or Grep for command line searching.

    Using Firebug it shows that the relevant element is PanelCategories.

    Searching for"PanelCategories" in Agent Ransack shows that it occurs in

    vanilla\applications\vanilla\views\modules\categories.php

    I'm assuming it would be this line

    <span class="Count"><?php echo number_format($CountDiscussions); ?>

    which you would need to edit.

    There's PowerGrep for windows...

  • AoleeAolee Hobbyist & Coder ✭✭
    edited January 2012

    shozen1 said: erm thanks @Aolee, but I was hoping someone could show me what the code looks like etc :)

    add this in your styles.css enjoy! :D

    Note: provided you are using the default theme

    ul.PanelCategories li.Depth2 span.Count { color: #E3F4FF; background: none repeat scroll 0 0 #E3F4FF; } ul.PanelCategories li.Depth2.Active span.Count { background: #fff; color: #fff; } ul.PanelCategories li.Active span.Count { background: #fff; color:#fff; } ul.PanelCategories li span.Count { background: none repeat scroll 0 0 #E3F4FF; color: #E3F4FF; }

    StumpyJoe
  • hbfhbf wiki guy? MVP

    im sorry, but, i can't see anything wrong with the code. i;'ll try running it on my test site as well. falling asleep at the moment gotta go.

Sign In or Register to comment.