LiquidWeb VPS Hosting

Announcement

Collapse
No announcement yet.

Forum Category Spacing on Homepage (no template editing required and vBCloud compatible)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Official - Free] Forum Category Spacing on Homepage (no template editing required and vBCloud compatible)

    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.

    Code:
    You need to be logged in to view the code. Login or Register now!
    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 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:
    Code:
    You need to be logged in to view the code. Login or Register now!
    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 screenshot. For actual demo, see homepage.

    This mod is also posted in vb org at http://www.vbulletin.org/forum/showthread.php?t=324053

    Enjoy!

  • #2
    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.

    Comment

    Working...
    X