[How-To] Add entries to AdminCP Navigation Menu
The AdminCP Navigation is now controlled through XML files.
To add custom entries, you must create a new file cpnav_yourhack.xml and place it in directory includes/xml. This XML-File constist of 6 important tags:
Example HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> With Beta 3 a new parameter displayorder has been introduced. This parameter is valid for Tags navgroup and navoption. This way it is possible to control in which order the Navgroups and Links will be displayed, and you can also add custom Links to existing Navgroups. To do so, your navgroup must have them same displayorder and Phrase Varname as the existing group: HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> To find out the Displayorder for existing groups, take a look at cpnav_vbulletin.xml. This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent. |
Thanks..
|
So, in doing this, does this take care of the issues with no hooks being included in the AdminCP navigation menu? I know that it does not take care of not having hooks in the individual modules, just refering to the main selection menu.
|
Quote:
The bummer here is that hack authors can't specify which existing group to add a menu item under (for instance, adding a new PM-related funtion or feature under the existing PM AdminCP tree) nor can hack authors specify a group that their hack should appear above or below. A hack author might want to add "Clans" right below Usergroups or Promotions. I'm guessing that new menus created with this XML technique appear way at the bottom? Of course to add all the functionality I am talking about, the admincp XML file would need to be cached in a "merged" state. |
Thanks KirbyDE in how to do this...
|
Quote:
It is bizzarre to be sure... I hope the Devs listen to the requests and create some kind of display order feature for the CP Nav ;) Satan |
Quote:
|
Aha - Glad someone knows ;)
Satan |
so kirby what changed in vb 3.5 beta 3? are you going to update this
|
Updated :)
|
thanks
|
I have a problem with the xml file which describes the menu I want to appear in the AdminCP.
If one of the options contains a link, which includes as a character, the character &, the menu does not appear. For example: Code:
<navoption displayorder="100"> If I replace the & character with a - or something, everything works. Is this a bug in the way the xml is handled or is this character not allowed? If so, how can I pass a link, which includes such a character? Thanks |
& is only allowed in CDATA (Character Data) Sections, otherwise you must use the entity &
|
Thanks Kirby, much appreciated.
Any other characters that are not allowed, that I need to be aware of? As you can tell, I have no expertise in XML. Thanks again. |
[ ] < > ' "
|
Thank you Sir!
|
Quote:
ok a Q about vb 3.5 beta 3 code if we open <text> shouldn't we close it with </text > why are we closing it as </phrase> in your code you show Code:
<navoption displayorder="1"> |
Its a typo.
|
Jep. That happens when you just "blindly" write "Code" without testing it ;)
Fixed. |
Is there a way with this XML to add a separator between navoptions to segregate different areas of the same navigation?
i.e. *NAVGROUP TITLE* view something view somethingelse *SEPARATOR* edit something edit somethingelse *SEPARATOR* delete something delete somethingelse Is this possible without having it get linked? I've already tried a single character in the link but it sends the navigation frame over into the main view if you accidentally click that.... |
You can add separators between Navgroups, but AFAIK it's not possible to add Spearators between Nav Options.
|
Thanks Kirby. :)
I am SO happy to see this addition to Beta3. :D |
Quote:
|
This one is not directly related to the subject, but it also is, somehow.
In the past, I modified the AdminCP menu of a hack of mine, depending on a parameter the user entered, adding or removing a line in the menu. If the condition of this parameter was changed, then I forced a reload of admincp, by redirecting the program to admincp/index.php. Obviously this method can no longer be used, and I have to have two different cpnav_xxx.xml files, one with the additional line and one with out it, and copy the one I need to the /includes/xml directory. However, my php knowledge is not that extensive, so can some one please tell me how I can do something like (in pseudo code): Code:
if (parameter==1) Thanks for your help. |
I believe this can easily be solved by offering the else-excluded option anyways, and then have this parameter check before any other code in the section in the file, and print out a cp message in the event that the option would not have been shown on the old menu.
|
Great tutorial again, thanks mate.
|
It would be really nice to be able to add options to existing groups. It's just much more organized than forcing every tiny little hack to have its own group. Any chance of this being added in the future?
|
Already possible since Beta 3 ...
|
How do I add my own options into the modcp?
|
Hook mod_index_navigation
|
Any ideas how to do the same, but to add to the navigation panel in the modcp Kirby ?
|
Hook mod_index_navigation
|
Is it me or did the last two posts repeat themselves? lol
|
No. I just posted the same answer twice, lol.
|
work with vB 3.5 Gold this ?
|
Sure.
|
Quote:
Code:
<navgroups product="vbulletin"> |
No :)
Hooks are only for PHP Code, not for XMLs ... |
what about the modcp, what xml file is the master for that?
|
Quote:
Hook mod_index_navigation |
All times are GMT. The time now is 11:45 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|