vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4.2 Navigation Manager - how to discussion (https://vborg.vbsupport.ru/showthread.php?t=283146)

BirdOPrey5 05-23-2012 07:15 PM

I see... This mod says it allows for drop down menus from Navtabs.

That is not a default feature in the new Navigation Manager.

Paul M 05-23-2012 07:16 PM

Quote:

Originally Posted by nhawk (Post 2332053)
If a dropdown menu with links is what you're talking about.. Please do tell how?

I didnt say anything about a drop down menu, there is no such option as that.

nhawk 05-23-2012 07:19 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2332057)
I see... This mod says it allows for drop down menus from Navtabs.

That is not a default feature in the new Navigation Manager.

Yeah, I saw that a couple of days ago. I was hoping that maybe some of that got incorporated in the new system.

But, for now creating a tab using the old navtab_end hook and template still works for those type of tabs.

odln018 05-23-2012 07:42 PM

1 Attachment(s)
Quote:

Originally Posted by Paul M (Post 2332048)
Its perfectly possible to have a tab with no target url defined, so its just to present a set of links.

However, bear in mind that no link will mean the system redirects you to your site default, so you may want to direct it (the tab) to something like forum.php.

OK, here is what I'd like to do (see attachment)

I added forum.php to a Special Access tab, but it still highlights the forum tab.

BirdOPrey5 05-23-2012 07:45 PM

Quote:

Originally Posted by odln018 (Post 2332073)
OK, here is what I'd like to do (see attachment)

I added forum.php to a Special Access tab, but it still highlights the forum tab.

:)

In Navigation Manager after you add the Tab "Paid Mods" you go to the drop down menu for "Paid Mods" and choose "Add Link" from the menu.

Each one of those options (Free Mods, Styles, etc...) is a Link I added via "Add Link."

Paul M 05-23-2012 08:49 PM

Quote:

Originally Posted by odln018 (Post 2332073)
I added forum.php to a Special Access tab, but it still highlights the forum tab.

You will need to turn on the append tabid option for that tab.

Boofo 05-23-2012 08:57 PM

Quote:

Originally Posted by Paul M (Post 2332089)
You will need to turn on the append tabid option for that tab.

Or add to Tab Script(s) setting. That was all I have to do to get the tab to highlight.

vbresults 05-23-2012 10:45 PM

I wonder if I won't need https://vborg.vbsupport.ru/showthread.php?t=271740 anymore :O

Boofo 05-23-2012 10:53 PM

Nope, with Andreas' add-on you can now do drop-down links with tabs.

AusPhotography 05-24-2012 12:49 AM

Quote:

Originally Posted by Boofo (Post 2332014)
What hooks do we use then if we want to add our own sublinb menu? I have one that uses the vb:each to get the post days for searching and I can't use the navigation manager to add that sub-menu.

Please see:
https://vborg.vbsupport.ru/showthread.php?t=283146
and
https://www.vbulletin.com/forum/show...t-Tab-in-4-2-0

The way I'm ding it is via a <navigation> section of my product files and only setting $show variables to control their display.

Boofo 05-24-2012 11:44 AM

Quote:

Originally Posted by snoopytas (Post 2332175)
Please see:
https://vborg.vbsupport.ru/showthread.php?t=283146
and
https://www.vbulletin.com/forum/show...t-Tab-in-4-2-0

The way I'm doing it is via a <navigation> section of my product files and only setting $show variables to control their display.

The Navigation Manager won't accept variables, though, and that is the issue I am having. I have a Search Posts sub-link menu that uses a setting to get the days.

Code:

7,14,30,120,180
etc...

I then use vb:each in the template to have it build the menu with the days links:

Code:

Posts for Last 7 Days
Posts for Last 14 Days
Posts for Last 30 Days
Posts for Last 120 Days
Posts for Last 180 Days

etc...

You can't do that in the Navigation Manager so I need to be able to add that sub-link where the New Posts link (below the navtabs) is now. Without the template hooks, I'm screwed.

nhawk 05-24-2012 02:01 PM

Quote:

Originally Posted by Boofo (Post 2332291)
The Navigation Manager won't accept variables, though, and that is the issue I am having. I have a Search Posts sub-link menu that uses a setting to get the days.

Code:

7,14,30,120,180
etc...

I then use vb:each in the template to have it build the menu with the days links:

Code:

Posts for Last 7 Days
Posts for Last 14 Days
Posts for Last 30 Days
Posts for Last 120 Days
Posts for Last 180 Days

etc...

You can't do that in the Navigation Manager so I need to be able to add that sub-link where the New Posts link (below the navtabs) is now. Without the template hooks, I'm screwed.

Like this?

http://snogssite.com/tempdown/likethis.jpg

1) Add a menu to the forum tab.
2) Add links to the menu.

In the example shown I didn't disable the original New Posts link.. you might want to do that too. :D

You can do this manually, in the install file for your mod, in a php file, in a plugin using the database, or I'm pretty sure dynamically in a plugin.

I'm using the database method for items that don't change frequently. The best place I've found for something that comes from a settings page is to use the admin_options_processing hook and add/modify the navigation items in the database.

Boofo 05-24-2012 04:36 PM

Yes, it is looks that but I use vb:each to get each link from the settings. I don't add them one by one. This is what I use in the template (wrapped in a vb:each) to get it to make the menu:

Code:

<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post&amp;days={vb:raw postdays}">{vb:rawphrase boofo_posts_from_last_x_days, {vb:raw postdays}}</a></li>

nhawk 05-24-2012 05:34 PM

Quote:

Originally Posted by Boofo (Post 2332382)
Yes, it is looks that but I use vb:each to get each link from the settings. I don't add them one by one. This is what I use in the template (wrapped in a vb:each) to get it to make the menu:

Code:

<li><a href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post&amp;days={vb:raw postdays}">{vb:rawphrase boofo_posts_from_last_x_days, {vb:raw postdays}}</a></li>

Since the settings are where the number of days are contained, get the template out of your head. It's not needed anymore. :)

Put the links in the navigation table and the phrases for those links in the phrase table via the admin_options_processing hook once and you're done.

The only time they would need to be updated is if the settings change and then you just update them via the same hook.

Badshah93 05-24-2012 05:45 PM

Quote:

Originally Posted by Boofo (Post 2332291)
The Navigation Manager won't accept variables, though, and that is the issue I am having. I have a Search Posts sub-link menu that uses a setting to get the days.

Code:

7,14,30,120,180
etc...

I then use vb:each in the template to have it build the menu with the days links:

Code:

Posts for Last 7 Days
Posts for Last 14 Days
Posts for Last 30 Days
Posts for Last 120 Days
Posts for Last 180 Days

etc...

You can't do that in the Navigation Manager so I need to be able to add that sub-link where the New Posts link (below the navtabs) is now. Without the template hooks, I'm screwed.

Try This Method

Hook: navigation_tab_complete

PHP Code:

if ($root == 'vbtab_forum')
{
$days = array(7,14,30,120,180);

$tabforumid $roots['vbtab_forum'];
$children = array();
foreach (
$days AS $day)
{
$children[] = array('title' => 'Post For Last ' 
$day ' Days''url' => 'search.php?do=process&searchdate=' $day'type' => 'link''root' => $tabforumid);  
}

$tabdata["$tabforumid"][children][] = array(
'root' => $tabforumid,
'type' => 'menu',
'title' => 'New Posts',
'children' => $children
);




Boofo 05-24-2012 06:00 PM

Yes, that worked., although it throws it as the end of the links instead of at the beginning where it needs to be. Plus I has more items in the menu too, but this is close.

nhawk 05-24-2012 06:05 PM

I'm really curious why people are so resistant to putting their navigation items in the database. It's easy to do and it only needs to be done once (or any time there's a change in the settings). And then the menu is handled by vB without the use of a plugin.

Badshah93 05-24-2012 06:07 PM

Quote:

Originally Posted by Boofo (Post 2332425)
Yes, that worked., although it throws it as the end of the links instead of at the beginning where it needs to be. Plus I has more items in the menu too, but this is close.

use array_slice, array_merge to adjust position

Boofo 05-24-2012 06:09 PM

Quote:

Originally Posted by nhawk (Post 2332426)
I'm really curious why people are so resistant to putting their navigation items in the database. It's easy to do and it only needs to be done once (or any time there's a change in the settings). And then the menu is handled by vB without the use of a plugin.

Because why make unnecessary queries when you don't have to?

nhawk 05-24-2012 06:11 PM

Quote:

Originally Posted by Boofo (Post 2332428)
Because why make unnecessary queries when you don't have to?

The only query you're making is when you add to the database when you save settings. The rest is already done by vB.

Boofo 05-24-2012 06:12 PM

I misunderstood what you meant then. My bad.

I had an options setting for the days in the mod.

nhawk 05-24-2012 06:18 PM

Quote:

Originally Posted by Boofo (Post 2332430)
I misunderstood what you meant then. My bad.

I had an options setting for the days in the mod.

Ah, it's a member option then. Not one set in the ACP.

That's a different animal then. ;)

Paul M 05-24-2012 06:28 PM

Not really, you just change

PHP Code:

$days = array(7,14,30,120,180); 

To pick up the settings from where-ever they are stored.



BTW, I would use ;

PHP Code:

$tabdata[$tabforumid]['children'][] = array( 

There isnt any reason to enclose $tabforumid in quotes, but children should be.

nhawk 05-24-2012 06:32 PM

I understand the array can be from anywhere. But, I'm trying to avoid the use of a plugin in most cases. Creating the links in the DB eliminates the plugin and allows vB to handle the menu system.

But I can see where using a plugin to create the menu would be needed at times. Heck, I'm the one that first questioned the dynamic creation of menus in this thread. :D

Boofo 05-24-2012 06:33 PM

Quote:

Originally Posted by nhawk (Post 2332434)
Ah, it's a member option then. Not one set in the ACP.

That's a different animal then. ;)

No, it was an admin cp option.

--------------- Added [DATE]1337888754[/DATE] at [TIME]1337888754[/TIME] ---------------

I'm getting W3C Validation errors like crazy now:

HTML Code:

syntax of attribute value does not conform to declared value

<li id=""><a href="search.php?do=process&amp;searchdate=90">Post For ?

The value of an attribute contained something that is not allowed by the specified syntax for that type of attribute. For instance, the ?selected? attribute must be either minimized as ?selected? or spelled out in full as ?selected="selected"?; the variant ?selected=""? is not allowed.

--------------- Added [DATE]1337896261[/DATE] at [TIME]1337896261[/TIME] ---------------

How do you get this to display in more than the forum tab when doing it via a plugun?

--------------- Added [DATE]1337896906[/DATE] at [TIME]1337896906[/TIME] ---------------

Quote:

Originally Posted by Badshah93 (Post 2332427)
use array_slice, array_merge to adjust position

I tried it with $roots, but it seems that isn't the right way.

AusPhotography 05-25-2012 11:18 PM

If you need to modify the Tab name on the fly...
Eg: Our photo competition system shows the number of competitions open for you to enter.

@hook: parse_templates (just convenient for me)
Code:

$vbphrase['vb_navigation_tab_YOURTABNAME_text'] = "New text";
Easy!

--------------- Added [DATE]1337991781[/DATE] at [TIME]1337991781[/TIME] ---------------

OP updated with correct hook name set_navigation_tab_fallaback

--------------- Added [DATE]1337992087[/DATE] at [TIME]1337992087[/TIME] ---------------

Using $root example here...

https://vborg.vbsupport.ru/showpost....&postcount=409

--------------- Added [DATE]1337993314[/DATE] at [TIME]1337993314[/TIME] ---------------

Also: More doco needed ... https://www.vbulletin.com/forum/show...96#post2297796

Easy5s.net 05-26-2012 03:10 AM

Pls help me:
https://vborg.vbsupport.ru/showthread.php?t=283451

Paul M 05-26-2012 10:11 AM

No one is going to just write code for you (well, unless maybe you pay them).

Boofo 05-26-2012 01:12 PM

Quote:

Originally Posted by snoopytas (Post 2332890)
If you need to modify the Tab name on the fly...
Eg: Our photo competition system shows the number of competitions open for you to enter.

@hook: parse_templates (just convenient for me)
Code:

$vbphrase['vb_navigation_tab_YOURTABNAME_text'] = "New text";
Easy!

Why nor just edit the phrase?

--------------- Added [DATE]1338041603[/DATE] at [TIME]1338041603[/TIME] ---------------

Quote:

Originally Posted by Paul M (Post 2333012)
No one is going to just write code for you (well, unless maybe you pay them).

Exsactly! As a lot of us are still leaning the new system, too. ;)

AusPhotography 05-26-2012 10:05 PM

Quote:

Originally Posted by Boofo (Post 2333063)
Why nor just edit the phrase?

Because it's dynamic!

We have a Competitions tab which shows Competitions (C,V) where C = competitions open to enter and V = competitions open for voting.
C and V set set per user based on their competition system status.

Boofo 05-26-2012 10:19 PM

Okay!

Christos Teriakis 05-27-2012 07:12 AM

Quote:

Originally Posted by Paul M (Post 2330700)
Custom $show variables can be created pretty much in any hook, as the navigation is almost the last thing built, but two common ones added for the purpose are load_show_variables & load_forum_show_variables.

If you don't mind, can you help me on how to convert a condition like:
Code:

<vb:if condition="$vbulletin->userinfo['permissions']['classifieds'] & $vbulletin->bf_ugp['classifieds']['moderate']">
to work as $show. I know that there are variables/condiltions like: $show['member'], but I was always using the above style.

Thank you
Chris

Boofo 05-27-2012 07:32 AM

Maybe something like this?

Code:

if (condition="$vbulletin->userinfo['permissions']['classifieds'] & $vbulletin->bf_ugp['classifieds']['moderate']") $show['classifieds'] = true;

Christos Teriakis 05-27-2012 07:36 AM

Quote:

Originally Posted by Boofo (Post 2333423)
Maybe something like this?

Code:

if (condition="$vbulletin->userinfo['permissions']['classifieds'] & $vbulletin->bf_ugp['classifieds']['moderate']") $show['classifieds'] = true;

Thank you. I'll try it. I suppose that I can add multiple conditions and end them like $show['classifieds_post'] = true, or $show['classifieds_moderate'] = true etc.

Thanks again
Chris

Boofo 05-27-2012 08:34 AM

Sure you can. As another example, here is one I use in the load_show_variables hook:

Code:

if ($vbulletin->products['adv_product_management4'] == 1) 

    $show['modtools_apm'] = true; 
    $show['modtools_pm'] = false; 

else 

    $show['modtools_apm'] = false; 
    $show['modtools_pm'] = true; 
}


If APM is installed it will use that link. If not, it default to the vb product manager.

I also use the show variables in the navigation_tab_complete, but you have to globalize it in that hook, as well as $vbphrase if you use that there, too.

Lionel 05-29-2012 03:33 AM

I found it to be much easier to use old system but at navtab_start and navtab_end.
then at navigation_tab_complete I empty $tabid for THIS_SCRIPT. This way I can keep all my dynamic navigations.

nhawk 05-29-2012 10:25 AM

A word about using the built in Navigation Manager...

If you use it as built in vB 4.2.0, add navtabs, menus or links and then delete them, the phrases used by those items are left behind in the phrase table.

Evidently it was designed to leave unused data in the database...

http://tracker.vbulletin.com/browse/VBIV-15177

Unfortunately, for some reason I don't have the option to petition to reopen that bug.

Altari 05-29-2012 02:20 PM

Hello,

I try to add 3 links in the Quick Links menu, but that doesn't work : Sometimes nothing is shown, sometime only the last link is shown... i don't really why, maybe someone could help me ?

Here is the code i'm using (tried to do it from Paul's blog) in build_navigation_array hook

PHP Code:

if ($show['member']) 

    
$userid vB::$vbulletin->userinfo['userid'];
    if (
vB::$vbulletin->options['rescue_lienannoncesonoff'] == 1
    {
        
$lien_mesannonces = array( 
            
'name' => 'rescue_commu_annonces'
            
'navtype' => 'link'
            
'url' => '{options.toppath}member.php?u='.$userid.'&tab=afficher_annonces',
            
'active' => 1
            
'productid' => 'rescue'
            
'text' => 'Mes annonces'
        ); 
        
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_commu_annonces'] = $lien_mesannonces;
    }
    
    
$lien_messujets = array( 
        
'name' => 'rescue_messujets'
        
'navtype' => 'link'
        
'url' => '{options.toppath}search.php?do=finduser&userid='.$userid.'&starteronly=1&contenttype=vBForum_Thread',
        
'active' => 1
        
'productid' => 'rescue'
        
'text' => 'Mes sujets'
    ); 
    
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_messujets'] = $lien_messujets;
    
    
$lien_mesmessages = array( 
        
'name' => 'rescue_mesmessages'
        
'navtype' => 'link'
        
'url' => '{options.toppath}search.php?do=finduser&userid='.$userid.'&starteronly=1&contenttype=vBForum_Post&showposts=1',
        
'active' => 1
        
'productid' => 'rescue'
        
'text' => 'Mes messages'
    ); 
    
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_mesmessages'] = $lien_mesmessages;
    unset(
$userid);



Boofo 05-29-2012 02:56 PM

You need to add this at the very top:

Code:

global $show;

And try the navigation_tab_complete hook instead.

Altari 05-29-2012 04:16 PM

Quote:

Originally Posted by Boofo (Post 2334311)
You need to add this at the very top:

Code:

global $show;

And try the navigation_tab_complete hook instead.

Hello,

Thank you for your help,
But this doesn't work better : I added the global show and change template hook, but nothing happen. I use VBOptimise(?), but i flushed the cache, cleared system cache etc... Nothing works like that :(

Anyway, i'm just trying to add this to start, and it doesn't work :
PHP Code:

global $show;
if (
$show['member'] == TRUE

    
$lien_messujets = array( 
        
'name' => 'rescue_messujets'
        
'navtype' => 'link'
        
'url' => '{options.toppath}search.php?do=finduser&userid='.$userid.'&starteronly=1&contenttype=vBForum_Thread',
        
'active' => 1
        
'productid' => 'rescue'
        
'text' => 'Mes sujets'
    ); 
    
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_messujets'] = $lien_messujets;




All times are GMT. The time now is 11:16 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02320 seconds
  • Memory Usage 1,896KB
  • 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
  • (16)bbcode_code_printable
  • (1)bbcode_html_printable
  • (5)bbcode_php_printable
  • (23)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
  • (40)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