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.
Options

Override WriteTableRow() and other vanilla/views/... files?

KlutzKlutz New
edited December 2014 in Vanilla 2.0 - 2.8

Hi,

I'd like to change a few things in the layout of the Categories view on my forum, but I'm not sure what is the best way to go about it.

For example, I'd like to merge the discussion count and reply count into a single column. It seems like I'd need to modify, or override the "WriteTableRow()" function in "vanilla/views/categories/helper_functions.php".

Is this a job best suited for a theme? A Plugin? Something else?

Comments

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Layout is always about the theme. It can involve using plugins. The merging of stats is something other than the theme. Why would you want to merge the comment count and discussion count into one single count?

    Or what you mean is simply moving the counts to another position in the page ?

  • Options

    @vrijvlinder said:
    Layout is always about the theme. It can involve using plugins. The merging of stats is something other than the theme. Why would you want to merge the comment count and discussion count into one single count?

    I don't want to merge the actual counts, I just want them both to be displayed in the same column (i.e.: "35 discussions, 112 comments").

    So, since this is simply moving stuff around, your saying this should be possible within a theme?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2014

    Yes for example if you want it to display like on this forum , try the BetterBitter theme.

    Also the statsbox plugin and others which display counts have a css file where you can further change things.

    To change the Categories layout you can pick different styles in the dashboard, to further change them use the CategoriesBg plugin.

  • Options
    KlutzKlutz New
    edited December 2014

    What do I need to add to my theme to change/override the contents of the default view files?

    To be even more explicit, I'd like to replace the following part of "vanilla/views/categories/helper_functions.php":
    <td class="BigCount CountDiscussions"> <div class="Wrap"> <?php // echo "({$Row['CountDiscussions']})"; echo BigPlural($Row['CountAllDiscussions'], '%s discussion'); ?> </div> </td> <td class="BigCount CountComments"> <div class="Wrap"> <?php // echo "({$Row['CountComments']})"; echo BigPlural($Row['CountAllComments'], '%s comment'); ?> </div> </td>

    With this:
    <td class="BigCount Counts"> <div class="Wrap"> <?php echo "({$Row['CountAllDiscussions']})"; ?> discussions, <?php echo "({$Row['CountAllComments']})"; ?> comments </div> </td>

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    If you want to edit a view, create a new file and call it helper_functions.php and place it in the views folder of your theme, then clone the functions over to the file you created and play around with editing it to see what happens. Just do not edit any of the core files.

Sign In or Register to comment.