4.2.0 Navgiation Manger Documentation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Exeter
    New Member
    • Mar 2009
    • 24

    [Forum] 4.2.0 Navgiation Manger Documentation

    Where is the documentation for the Navigation Manger feature?

    I recently upgraded my test environment. Adding a new tab and custom menu link does not work properly.

    Repro:
    Add new Tab: MyTab
    Add a menu item: MyItem myscript.php
    When a user pulls up myscript.php, the FORM tab is active instead of the MyTab tab.

    Does myscript.php need some sort of tag to work with the Navigation Manager?

    Weird
  • Maurd
    Senior Member
    • Jun 2011
    • 672
    • 4.1.x

    #2


    But yes, it should have a "tag" in the form of THIS_SCRIPT.

    For example, if myscript.php was defined as:
    Code:
    define('THIS_SCRIPT', 'album');
    You would add album to the "Tab Script(s)" section when editing MyTab. Alternately, you can use a plugin and hook, but I'm not (personally) sure about how to accomplish that at this moment.

    This can be used to specify a number of scripts that the system will use to check if the Tab should be seleted. The constant THIS_SCRIPT is checked, and if it matches any of the specified script names, the tab will be marked to be displayed as selected. All vBulletin frontend scripts set a THIS_SCRIPT value.

    You can specify more than one by joining them with a dot - however, this option is limited to 30 characters maximum, it is not designed for mass usage. If you are writing a product that uses many different scripts, you should set your own constant in them, and use the 'set_navigation_tab' hook to detect this constant and set your selected tab.
    - Maurice Workin' in the Jira mine, goin' down, down, down

    Comment

    • Exeter
      New Member
      • Mar 2009
      • 24

      #3
      Thanks for the reply.
      I figured out how to get this done with a hook late last night.

      1)Define THIS_SCRIPT in your script.
      define('THIS_SCRIPT', 'scriptname.php');

      2) Create this hook
      //hook set_navigation_tab_main
      if (THIS_SCRIPT == 'scriptname.php')
      {
      $request_tab = 37;
      }

      37 is the ID of the tab.
      You can get that ID from the navgiation manager. Look at the hyperlinks displayed (by your browser) for closed tabs. Those links have the ID as a parameter.

      Comment

      • Wayne Luke
        vBulletin Technical Support Lead
        • Aug 2000
        • 73981

        #4
        Originally posted by Exeter
        1)Define THIS_SCRIPT in your script. My defines end in '.php', which seems to break the solution detailed in the previous post.
        define('THIS_SCRIPT', 'scriptname.php');
        You shouldn't have .php here.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment

        • Paul M
          Former Lead Developer
          vB.Com & vB.Org
          • Sep 2004
          • 9886

          #5
          Originally posted by Exeter
          Thanks for the reply.
          I figured out how to get this done with a hook late last night.

          1)Define THIS_SCRIPT in your script.
          define('THIS_SCRIPT', 'scriptname.php');

          2) Create this hook
          //hook set_navigation_tab_main
          if (THIS_SCRIPT == 'scriptname.php')
          {
          $request_tab = 37;
          }

          37 is the ID of the tab.
          You can get that ID from the navgiation manager. Look at the hyperlinks displayed (by your browser) for closed tabs. Those links have the ID as a parameter.
          All you need to do is ;

          1. define('THIS_SCRIPT', 'scriptname'); // note, no .php

          2. In the settings for the Tab (In Nav Man) enter scriptname in the scripts setting, and save.
          Baby, I was born this way

          Comment

          • tonmo
            Senior Member
            • Dec 2004
            • 235
            • 5.0.X

            #6
            What if said script is a vbcms article, and you want that one article to be on the navbar? Is there a way to define this_script for a specific article via CMS?

            Comment

            • Matthew Gordon
              Senior Member
              • May 2002
              • 3243
              • 1.1.x

              #7
              Originally posted by tonmo
              What if said script is a vbcms article, and you want that one article to be on the navbar? Is there a way to define this_script for a specific article via CMS?
              THIS_SCRIPT is already defined globally for the CMS, you can't change it like that. You'd need to write a plugin to handle selecting the tab in this case.

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...