vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Arrange Sub-Forums in columns (https://vborg.vbsupport.ru/showthread.php?t=63498)

tamarian 04-04-2004 10:00 PM

Arrange Sub-Forums in columns
 
There's also a vB 3.5 version here: https://vborg.vbsupport.ru/showthrea...threadid=82845

What it does
This hack arranges sub-forums on the forum home into 2 (or more) columns, makeing large lists of sub-forums more presentable. You can see it in action on my forums here:

Demo
http://forum.lowcarber.org

Note:
1. You need to enable sub-forum display on the forum home from your vB admin panel
2. This hack is for the forum home page, not forum display.


To enable sub-forums on the forum home page
1. Go to your forum Admin panel
2. Click vBulletin Options
3. Select "Forum Listings Display Options" from the drop down list
4. In "Depth of Sub-Forums" replace 0 with 1

Installation
To install, edit the file functions_forumlist.php (in the includes directory)

1. Find

PHP Code:

      foreach($vbulletin->iforumcache["$parentid"] AS $forumid

Place this code above it:

PHP Code:

$output .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" ><tr valign=\"top\"> ";
      
$cols 0

2. Find
PHP Code:

            eval('$subforum = "' fetch_template("forumhome_subforumbit_$canpost") . '";');
            if (!empty(
$output))
            {
                
$subforum $splitter["$canpost"] . $subforum;
            }
            if (
$depth $vbulletin->options['subforumdepth'])
            {
                
$output .= construct_subforum_bit($forumid$cancontainthreads$subforum$depthmark '--'$depth 1);
            }
        }
    }

    return 
$output;



Replace with
PHP Code:

            eval('$subforum = "' fetch_template("forumhome_subforumbit_$canpost") . '";');
                    if (
$depth $vbulletin->options['subforumdepth'])
                        {
                                
$cols++;
                                if (
$cols==3)
                                        {
                                        
$cols 1;
                                        
$output .=  "</tr><tr>";
                                        }

                        
$output .= '<td width="50%">' construct_subforum_bit($forumid$cancontainthreads$subforum$depthmark '--'$depth 1) . "</td>";
                        }
        }
    }

        if (
$cols ==1$output.="<td>&nbsp;</td></tr></table>";
    else 
$output.="</tr></table>";

        return 
$output;



To put them in 3 columns, instead of t2, just edit this line "if ($cols==3)" to "if ($cols==4)" and change this line:

PHP Code:

                  $output .= "<td width=\"50%\">" construct_subforum_bit($forumid$cancontainthreads$subforum$depthmark '--'$depth 1) . ""

To this:
PHP Code:

                  $output .= "<td width=\"33%\">" construct_subforum_bit($forumid$cancontainthreads$subforum$depthmark '--'$depth 1) . ""

Template modification (optional)
As this hack will list the sub-forums in a table, the font used is not effected by the <div> tag for subforums, which will cause the default font to be used instead of smallfont.

To use smallfont for sub-forum names, edit the "forumhome_subforumbit_post"

Change (this is the whole template)
Code:

<img class="inlineimg" src="$stylevar[imgdir_statusicon]/subforum_$forum[statusicon].gif" alt="" /> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">$forum[title]</a>
To:
Code:

<img class="inlineimg" src="$stylevar[imgdir_statusicon]/subforum_$forum[statusicon].gif" alt="" /> <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><span class="smallfont">$forum[title]</span></a>

And for those who want to edit or remove the "Sub-forum" word, just remove (or edit, if you just want to change it) "<strong>$vbphrase[subforums]</strong>:" from the "forumhome_forumbit_level2_post" template

Screen shots, before/after

diettalk 04-05-2004 09:36 PM

Works great.. thanks.

Tradjick 04-05-2004 10:10 PM

Excellent superb idea! :)
Would it be possible to determine the screen resolution from the visitor? Depending on whether to display the subforums the default or your hacked way??? I could need this because I have 7 subforums including 70 sub-sub forums.

Vb-Hispano 04-05-2004 11:19 PM

nice idea ;)

thanks good job

INSTALLED

sabret00the 04-05-2004 11:40 PM

screenshot?

Fi_InCogNiTo 04-05-2004 11:47 PM

I made the changes, but nothing happens. It doesn't arrange my forums in sub-columns like on your site=\

It just looks the same as standard vB3 subforums.

I'm 100% sure I made the changes correctly.

EDIT: Maybe this conflicts with the category image or the Forums arranged in columns on forumhome hacks?

tamarian 04-05-2004 11:51 PM

Quote:

Originally Posted by sabret00the
screenshot?

http://forum.lowcarber.org/

tamarian 04-05-2004 11:55 PM

Quote:

Originally Posted by Fi_InCogNiTo
I made the changes, but nothing happens. It doesn't arrange my forums in sub-columns like on your site=\

It just looks the same as standard vB3 subforums.

I'm 100% sure I made the changes correctly.

Hmm, that's weird. Are you sure you saved your changes? Refreshed the page?

Fi_InCogNiTo 04-05-2004 11:56 PM

Sorry, edited the post... look again =D

Here is what that hack changed.. (attached)

Itworx4me 04-06-2004 12:01 AM

Quote:

Originally Posted by Fi_InCogNiTo
Sorry, edited the post... look again =D

Here is what that hack changed.. (attached)

Just an FYI

This hack that you have here isn't for this one in this thread. They are two separate hacks.


All times are GMT. The time now is 02:00 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01316 seconds
  • Memory Usage 1,770KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete