vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=324053

[vBMods.rocks] Forum Category Spacing - no template editing needed/vBCloud compatible
by noypiscripter
21 Dec 2016 19:12

Want to separate or group forum categories in its own "table" without editing display_Forums_list template? The entire category and forum directory are displayed using a single <table> tag. This makes it impossible to separate the forums by category in its own table that has border without editing display_Forums_list template and adding multiple <table> tags as others had done. But not until now.

I thought that mod was great (and it is!) but it requires editing an existing template and most of you know that editing existing vBulletin templates is not recommended and ideal. So I got challenged to create my own version that doesn't require editing using pure CSS. But technically not really using pure CSS as I had no choice but to add a little bit of JavaScript in order to programmatically identify which is the last forum channel in a category. Knowing the last forum in a category enables the CSS to know where to break the table into multiple "tables". The end result is not using multiple actual <table> tags but with a little bit of creativity and imagination, I was able to replicate an illusion or impression of using multiple tables.

Without much further ado, here's how to accomplish this.

1. Add in css_additional template or via Sitebuilder (Edit Site ON) > Style > CSS Editor.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

NOTE: The border colors and spacing used above were based off the default vB5 style. You may need to tweak some values if you have a customized style/theme.


2. Add a script to dynamically determine the last forum in a category. Ideally, we should use a template hook to insert the script but unfortunately, there is no hook location that is close to the forum directory list. We need to run the script as soon as the forum directory is rendered to avoid flickering or flashing. I chose to add the script in the Mark Channels Read phrase which is right below the forum directory.
  • Go to AdminCP > Languages & Phrases > Search in Phrases.
  • Search for Mark Channels Read phrase
    • Search for text: mark_channels_read
    • Search in: Phrase Variable Name Only
  • In the English (US) Translation box, enter the following:


    Block Disabled:      (Update License Status)  
    Suspended or Unlicensed Members Cannot View Code.

    NOTE: You can change Mark Channels Read with whatever phrase you want.
  • Save.

Compatibility:
  • Tested in vB 5.2.5 but this should work in older versions too.
  • Compatible with vBCloud.

Demo:
See homepage of my mod site at http://vbmods.rocks/

This mod is also posted at http://vbmods.rocks/forum/vbulletin-...oud-compatible

Enjoy! :)

In Omnibus 21 Dec 2016 19:50

I like it. It looks really clean from the image on your site.

How difficult would it be to make each "table" collapsible?

noypiscripter 21 Dec 2016 22:43

I will look into it.

noypiscripter 21 Dec 2016 23:24

Found a bug in the script. Updated the script in Step 2 in the first post. If you've already installed this mod, you have to update it.

Hectorsky 15 Oct 2018 11:59

Got and issue with thise code, grid lines does not finish at the end of category, any advice?>


All times are GMT. The time now is 05:12.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.