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)
-   -   Miscellaneous Hacks - navbar forumjump dropdown (https://vborg.vbsupport.ru/showthread.php?t=134482)

Floris 12-20-2006 10:00 PM

navbar forumjump dropdown
 
This is beta, and I won't support it.

What does this do?

This will add a dropdown to your navbar that lists the forums below a parent forum.

On my bro's site we have a list of 12 worksheets, and each worksheet is a forum. We needed a list of all 12 worksheets for quick navigation. Instead of me getting emails every time they make a forum change, the dropdown is now auto updated, populated and I don't have to worry those emails anymore.

It uses forumcache (tnx danny) so it won't add a query to each page, unless it needs to.

===== TEMPLATE CHANGES =====
Open the template: navbar, and find this code:
Code:

<if condition="$show['registerbutton']">
Above this, add the following code:
Code:

<td id="navforums" class="vbmenu_control"><a href="$show[nojs_link]#navforums">Pick a Forum!</a> <script type="text/javascript"> vbmenu_register("navforums"); </script></td>
Then find this code:
Code:

<!-- / NAVBAR POPUP MENUS -->
And above this, add the following code:
Code:

<!-- popup navforums -->
    <div class="vbmenu_popup" id="navforums_menu" style="display:none">
        <table cellpadding="4" cellspacing="1" border="0">
            <tr><td class="thead">Quickly jump to one of the forums</td></tr>
                $navbarforum
        </table>
    </div>
    <!-- / popup navforums -->

And save the template.

===== PLUGIN =====
Create a new plugin in the global_start hook location, call it navbarforums and give it this code:
Code:

if (is_array($vbulletin->forumcache))
{
    foreach ($vbulletin->forumcache AS $forum)
    {
          if ($forum[parentid] == 7)
          {
        $navforumid = $forum[forumid];
                $navforumtitle = $forum[title];
                $navbarforum .= "<tr><td class=\"vbmenu_option\"><a href=\"forumdisplay.php?f=".$navforumid."\" rel=\"nofollow\">".$navforumtitle."</a></td></tr>";
          }
    }
}
else
{
      $navbarforums = $db->query_read("
        SELECT forumid, title
        FROM " . TABLE_PREFIX . "forum
        WHERE parentid = '7'
        ");

        while ($navbarresult = $db->fetch_array($navbarforums))
        {
            $navforumid = $navbarresult[forumid];
            $navforumtitle = $navbarresult[title];
            $navbarforum .= "<tr><td class=\"vbmenu_option\"><a href=\"forumdisplay.php?f=".$navforumid."\" rel=\"nofollow\">".$navforumtitle."</a></td></tr>";
        }
}

Find the if ($forum[parentid] == 7) to point to your forumid
(that means, change the 7 to your PARENT forumid, as it will get all the childforums below this parent)

And you're done.

Q : Does it list the subforums below the forums too?
A : No, only the first level forums below the parentid.

Q : My list is too long!
A : Your parentid has a lot of forums.

Apoco 12-21-2006 12:17 AM

wtf no plugin or products? >_>

Why are there no phrases?

Apoco 12-21-2006 12:18 AM

Screenshot? Live Demo? Anything? I don't understand

Hornstar 12-21-2006 04:44 AM

A demo site or a screen shot would be great to see it in action. Thanks.

bashy 12-21-2006 05:10 AM

Quote:

Originally Posted by Apoco (Post 1142554)
wtf no plugin or products? >_>

Why are there no phrases?

===== PLUGIN =====
Create a new plugin, call it navbarforums and give it this code:

Floris 12-21-2006 02:00 PM

Quote:

Originally Posted by Apoco (Post 1142554)
wtf no plugin or products? >_>

Why are there no phrases?

This is no product, hence why it isn't added as a product. It has no phrases, it is a beta. So there's no need to make this a product. It is a plugin, the instructions say to create a new plugin. So no need to add a plugin.xml as you have to edit the code anyway. Takes away one step during install. ;)

Quote:

Originally Posted by Apoco (Post 1142555)
Screenshot? Live Demo? Anything? I don't understand

There's no need for a demo, it is a dropdown .. and it has the same forum titles listed as the forums below the parent you've picked, just conv. listed in a dropdown for quick access. ;)


Quote:

Originally Posted by hornstar1337 (Post 1142628)
A demo site or a screen shot would be great to see it in action. Thanks.

Take a look at any dropdown on any vb powered site in the navbar, that's how it would look, only now with titles from forum names. ;)

Quote:

Originally Posted by bashy (Post 1142634)
===== PLUGIN =====
Create a new plugin, call it navbarforums and give it this code:

exactly ;)

Darat 12-21-2006 02:09 PM

What hook location for the plugin?

teeech 12-21-2006 08:02 PM

I got the code placed correctly but I don't get a list of forums. I changed the parent ID to accomodate one of my forum id's but no dice.

also, would I repeat a portion of the code if I wanted to display multiple "parents"?

I understand you don't support this, but I'd appreciate a little help from anyone that's got it working properly.

Floris 12-22-2006 06:52 AM

global_start, as the navbar is for every page

Ramsesx 12-25-2006 09:51 PM

Nice and thanks, but sad doesn't work on a vba cmps index page. For people who asked for a screenshot, have a look to the attached one. Oh, and I saw it now, attention it's listening hidden forums for all users (guests) too.


All times are GMT. The time now is 09:20 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.01116 seconds
  • Memory Usage 1,747KB
  • 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
  • (5)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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