vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Mini Mods - Forum Jump In Navbar (https://vborg.vbsupport.ru/showthread.php?t=151356)

P1erce 07-03-2007 10:00 PM

Forum Jump In Navbar
 
Okay a few notes first.

A. I wont support this software
B. I dont plan to improve it unless I have a requirement to do so personally for www.minimins.com
C. If you want to modify it, change it, make it something like DigitalPoint.com drop down, and charge for the modification be my guest, ill even pay for it :)
D. Thanks to the original idea at http://forums.digitalpoint.com
E. I dont know how to make a plugin so dont say anything about it not being a plugin.
F. It wont work as guest on my forum for SEO reasons. But please dont register on my forum just to see it in action, the screenshot says it all.
G. Dont complaine about my code, it works, but I accept it may not be the best way to do this.
H. Its the code for the Forum Jump menu, so its dynamic. If you have admin forums thoes who can see thoes forums will be able to see it in the jump menu, thoes who dont, wont simple :)

So, right, theres various other attempts at making this dropdown but to be honest they were not adequait. As such I spent 4/5 hours making my own one from the Forum Jump menu function.

The code!

1. Plugin Mangager
2. Add New Plugin

hook location : global
name : whatever, i called it "navbar jump menu"

This is the code:

PHP Code:

//copyright MiniMins.com
function construct_jump2($parentid = -1$addbox true$prependchars ''$permission '')
{    
    global 
$vbulletin$optionselected$usecategories$jumpforumid$jumpforumtitle$jumpforumbits$curforumid$daysprune$jumpforumbits2;
    global 
$stylevar$vbphrase$defaultselected$forumjump$selectedone;
    global 
$frmjmpsel// allows context sensitivity for non-forum areas
    
global $gobutton;
    static 
$complete false;
    

    if (
$complete OR !$vbulletin->options['useforumjump'] OR !($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']))
    {
        return;
    }

    if (empty(
$vbulletin->iforumcache))
    {
        
// get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
        
cache_ordered_forums(01);
    }
    if (empty(
$vbulletin->iforumcache["$parentid"]) OR !is_array($vbulletin->iforumcache["$parentid"]))
    {
        return;
    }

    foreach(
$vbulletin->iforumcache["$parentid"] AS $forumid)
    {
        
$forumperms $vbulletin->userinfo['forumpermissions']["$forumid"];
        
#if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums']) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['showonforumjump']) OR !$vbulletin->forumcache["$forumid"]['displayorder'] OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active']))
        
if ((!($forumperms $vbulletin->bf_ugp_forumpermissions['canview']) AND ($vbulletin->forumcache["$forumid"]['showprivate'] == OR (!$vbulletin->forumcache["$forumid"]['showprivate'] AND !$vbulletin->options['showprivateforums']))) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['showonforumjump']) OR !$vbulletin->forumcache["$forumid"]['displayorder'] OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active']))
        {
            continue;
        }
        else
        {
            
// set $forum from the $vbulletin->forumcache
            
$forum $vbulletin->forumcache["$forumid"];

            
$optionvalue $forumid;
            
$optiontitle $prependchars $forum[title_clean]";

            
$optionclass 'fjdpth' iif($forum['depth'] > 44$forum['depth']);

            if (
$curforumid == $optionvalue)
            {
                
$optionselected 'selected="selected"';
                
$optionclass 'fjsel';
                
$selectedone 1;
            }
            else
            {
                
$optionselected '';
            }

            
//eval('$jumpforumbits2 .= "' . fetch_template('option') . '";');
            //$jumpforumbits2 .= 
            
$jumpforumbits2[$optionvalue] .= "<a href=\"forumdisplay.php?f=".$forumid."\">".$optiontitle."</a>";
            
construct_jump2($optionvalue0$prependchars FORUM_PREPEND$forumperms);
            

        } 
// if can view
    
// end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)

}

function 
jumpforumbits2html()
{
    global 
$jumpforumbits2;
    
    
$forumNavJumpMenu "<div class=\"vbmenu_popup\" id=\"navbar_forumjump_menu\" style=\"display:none; position:absolute; padding: 0px;\">\n";
    
$forumNavJumpMenu .= "\t<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\">\n";
    
$forumNavJumpMenu .= "\t\t<tr><td class=\"tcat\" colspan=\"6\" style=\"padding: 4px\">Forums</td></tr>\n";
    
$forumNavJumpMenu .= "\t\t<tr class=\"fjump\">\n";
    
$forumNavJumpMenu .= "\t\t\t<td valign=\"top\">\n";
    
    
$start true;
    
    foreach(
$jumpforumbits2 AS $bit)
    {
        
$canArray explode("&nbsp;",$bit);
        if(
$canArray[1] != " ")
        {
            
//this is the table heading!
            //end previous table
            
if(!$start)
            {
                                                
//uncomment if you want multiple columns
                //$forumNavJumpMenu .= "\t\t\t\t</table>\n";
                //$forumNavJumpMenu .= "\t\t\t</td>\n";
                //$forumNavJumpMenu .= "\t\t\t<td valign=\"top\">\n";
            
}
            
//start table - uncomment the next 2 lines if you want.. multiple columns rather than 1 solid column
            //$forumNavJumpMenu .= "\t\t\t\t<table cellpadding=\"2\" style=\"border-bottom:1px solid #fff; border-collapse: collapse; padding:1px;\">\n";
            //$forumNavJumpMenu .= "\t\t\t\t<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\">";
            //start header
            
$forumNavJumpMenu .= "\t\t\t\t\t<tr><td class=\"thead\">".$bit."</td></tr>\n";
        }
        else
        {
            
//just a normal heading
            
$forumNavJumpMenu .= "\t\t\t\t\t<tr><td class=\"vbmenu_option\">".$bit."</td></tr>\n";
        
        }
        
        
$start false;
    }
    
    
//end tables
    
$forumNavJumpMenu .= "\t\t\t\t</table>\n";
    
$forumNavJumpMenu .= "\t\t\t</td>\n";
    
$forumNavJumpMenu .= "\t\t</tr>\n";
    
$forumNavJumpMenu .= "\t</table>\n";
    
$forumNavJumpMenu .= "</div>";
    
    return 
$forumNavJumpMenu;
    
}
$forumNavJumpList construct_jump2();

$forumNavJumpMenujumpforumbits2html(); 

Now, heres the code for the navbar, place it where you want the dropdown.

Code:

<td id="navbar_forumjump" class="vbmenu_control"><a href="$show[nojs_link]#forumjump" accesskey="j">Forum Jump</a> <script type="text/javascript"> vbmenu_register("navbar_forumjump"); </script></td>
And place this before <!-- / PAGENAV POPUP -->

Code:

<!-- Forum Jump -->
$forumNavJumpMenu
<!-- /ForumJump -->

So you can format the HTML to change the format from single column to multi column. Just uncomment the lines required. (see the comments in the source). I used a single column because I have too many sub forums and I didnt want to negoicate on the size of the text and it was going off the screen, so a single column was better suited to my needs.

If you have any general questions about the code Ill try and help. But the one part and dont ask me, is the recursvie function in construct_jump2 I barely understand it myself.

Enjoy :)

P1erce 07-04-2007 04:37 PM

In tradition i reserve the first post :)

Kaleem 07-04-2007 05:43 PM

How is it different from this ?
https://vborg.vbsupport.ru/showthread.php?t=133277

P1erce 07-04-2007 05:48 PM

see the last box of code on that post?

You have to manually define every forum url and forum name. The one above fully automatic/dynamic content.

For me, with 100 forums, that was just totaly impractical. I did start and got through 20 forums and just got sick of it. Because I knew I would be moving forums around, renaming etc, so this semi-mod was created :)

Pierce

Magnumutz 07-04-2007 06:00 PM

Heh... very nice. Good job !!
*Clicks install*

Later edit: Damn... my skin is too modified to use it :|
Hope i can modify it some way.

projectego 07-04-2007 06:10 PM

Awesome! Thank you very much! :D

SkyCatcher 07-04-2007 06:51 PM

I took a look at it and made you a nice little product file. The code is unchanged from what you've posted. Users still need to make the 2 template edits.

I played with this for about an hour coming up with a simple if($i = 6) {$pagenavthingy .="<br />";} but it doesn't work that way :/

The way the HTML is coded, it will count the categories and forums as the same thing so:

Lobby (Category)
Forum1
Forum2

That would be 3 loops instead of 1 :(

Which means it needs an extra check... if act as forum = 0 then counter+1.. then when counter = 6, throw in a <br /> and reset to 0. Then clean up the html code and you should be on your way if you care to make it resemble the other site.


Edit: Good lord my spelling is off!

P1erce 07-04-2007 06:54 PM

Quote:

Originally Posted by SkyCatcher (Post 1282831)
I took a look at it and made you a nice little product file. The code is unchanged from what you've posted. Users still need to make the 2 template edits.

I played with this for about an hour coming up with a simple if($i = 6) {$pagenavthingy .="<br />";} but it doesn't work that way :/

The way the HTML is coded, it will count the categories and forums as the same thing so:

Lobby (Category)
Forum1
Forum2

That would be 3 loops instead of 1 :(

Which means it needs an extra check... if act as forum = 0 then counter+1.. then when counter = 1, throw in a <br /> and reset to 0. Then clean up the html code and you should be on your way if you care to make it resemble the other site.


Edit: Good lord my spelling is off!

Thanks!!

bhen13 07-04-2007 07:06 PM

does it work with 3.6.5.?

SkyCatcher 07-04-2007 07:08 PM

Quote:

Originally Posted by bhen13 (Post 1282838)
does it work with 3.6.5.?

Tested with 3.6.7PL1 here so yeah, should work with 3.5.x and 3.6.x


All times are GMT. The time now is 02:33 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.01143 seconds
  • Memory Usage 1,802KB
  • 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
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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