Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Adding a tab to the menu

edited March 2007 in Vanilla 1.0 Help
One of the items in the update is: "Tabs can now be added to the menu and forced into a particular position." Where do I do this?
«13

Comments

  • actually, i would like to know about this as well. i didnt even notice that was included.
  • there was a thread about this... basically you can write an extension that will add the tab. hold on i'll find it.
  • jonezyjonezy New
    edited July 2005
    if (in_array($Context->SelfUrl, array("index.php", "categories.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))) { $Menu->AddTab("Family Photos", "family_photos", "./images/", "PhotosTab"); }

    that's the code to do it... though i don't know the new method for specifying the order of the tabs.
  • MarkMark Vanilla Staff
    The new method is a little different, and it allows you to force a tab into whatever slot you want. Take a look at controls/common.controls.php and do a search for "class Menu". You'll see the AddTab method in there and see what all of the parameters are. Sorry I can't spell it out for you - I've got work to do.
  • jonezyjonezy New
    edited July 2005
    $Menu->AddTab($Text, $Value, $Url, $CssClass, $Attributes = "", $Position = "0", $ForcePosition = "0")

    that's the new syntax
  • my head is gunna explode looking at all this nonsense. mark, i demand you come over here and spoon feed me instructions...and maybe some applesauce.
  • yes, will someone please make a step-by-step tutorial for all these changes!
  • dudes we have to wait for the documentation :(
  • ...wait, do we just have to make another extension to add a tab? we don't put that line of code in the common.controls.php we just add it into an extension?
  • yes you would make an extension to add a tab
  • BenBen
    edited July 2005
    ahh, that solves a lot
    so what do all the variables represent? specifically, $Variables $Value and $Name
  • wait where are you seeing those variables? in a specific extension?
  • BenBen
    edited July 2005
    in the syntax you posted above,
    I turned that into
    $Menu->AddTab(Users, Users, "search.php?PostBackAction=Search&Keywords=&btnSubmit=Search&Type=Users", UsersTab, $Attributes = "", $Position = "4", $ForcePosition = "1")
  • jonezyjonezy New
    edited July 2005
    oh uyou have to wrap each of the values in quotes

    $Menu->AddTab("Users", "Users","search.php?PostBackAction=Search&Keywords=&btnSubmit=Search&Type=Users", "UsersTab", $Attributes = "", $Position = "4", $ForcePosition = "1")
  • specifically the Users, Users, UsersTab
  • just realised that before you said :D
    thanks anyway
  • wow, i have a whole 2 extensions
  • no problem...
  • BenBen
    edited July 2005
    here's the whole of the extension, i found it caused some errors on login and logout so i changed it slightly. Thanks to jonezy
    It adds a tab to the menu linked to a search for all users.

    /* Extension Name: Ben's Alter Menu Extension Extension Url: http://soul-scape.com/ Description: Adds extra tabs to the menu. Version: 1.0 Author: Ben Author Url: http://www.soul-scape.com/ */ if (in_array($Context->SelfUrl, array("index.php", "categories.php", "comments.php", "search.php", "post.php", "account.php", "settings.php"))) { $Menu->AddTab("Users", "Users", "search.php?PostBackAction=Search&Keywords=&btnSubmit=Search&Type=Users", "UsersTab", $Attributes = "", $Position = "4", $ForcePosition = "1"); }
    EDIT: just added it to the Vanilla Wiki under Extensions
  • nice work!
This discussion has been closed.