vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-To] Add entries to AdminCP Navigation Menu (https://vborg.vbsupport.ru/showthread.php?t=82698)

Dream 06-27-2005 07:35 PM

thanks

sv1cec 07-01-2005 12:27 PM

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">
        <text>Statistics - Warnings Per User</text>
        <link>admin_warn.php?act=viewwarnedusers&type=warnings</link>
</navoption>

Them the menu refuses to appear. Instead, an empty menu is shown.

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

Andreas 07-01-2005 12:49 PM

& is only allowed in CDATA (Character Data) Sections, otherwise you must use the entity &amp;

sv1cec 07-01-2005 01:05 PM

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.

Andreas 07-01-2005 01:53 PM

[ ] < > ' "

sv1cec 07-01-2005 01:58 PM

Thank you Sir!

Ranma2k 07-01-2005 09:58 PM

Quote:

Originally Posted by KirbyDE
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:
  • <navgroups>
    This indicates that this is a XML File containing navgroups.
    It has one parameter product that should be set to vBulletin
  • <navgroup>
    This is the container for one Settings-Group, like Stales & Templates, vBulletin Options, etc.
    It has three parameters: phrase/text, permissions and hr.
    If you are using phrases, phrase must contain the variable name, if you are using hardcoded text then text must contain the label.
    Parameter permissions (optional) can be used to check an administrator permission, like canadminoptions.
    Parameter hr (optional) can be used to put a spacer below this navgroup.
  • <navoption>
    This is one Menu-Entry.
  • <phrase> or <text>
    This must contain the varname or hardcoded text for the menuetry.
  • <link>
    Tag link must contain the URL.
    You can use {$vbulletin->config[Misc][modcpdir]} to point to the ModCP directory here, no matter how it is actually called

Example
HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<navgroups product="vBulletin">
        <navgroup phrase="demohack_settings" hr="true">
                <navoption>
                        <phrase>demohack_foo</phrase>
                        <link>demohack.php?do=foo</link>
                </navoption>
                <navoption>
                        <phrase>demohack_modcp</phrase>
                        <link>../{$vbulletin->config[Misc][modcpdir]}/foobar.php</link>
                </navoption>
        </navgroup>
        <navgroup text="Demohack Settings">
                <navoption>
                        <text>Demohack Foo</text>
                        <link>demohack.php?do=foo</link>
                </navoption>
                <navoption>
                        <text>Demohack ModCP</text>
                        <link>../{$vbulletin->config[Misc][modcpdir]}/foobar.php</link>
                </navoption>
        </navgroup>
</navgroups>

Update for Beta 3
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 su, your navgroup must hav them same displayorder and Phrase Varname as the existing group:

HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<navgroups product="vBulletin">
        <navgroup phrase="forums_and_moderators" displayorder="60">
                <navoption displayorder="1">
                        <text>Top-Link Forums & Moderators</phrase>
                        <link>demohack.php?do=foo</link>
                </navoption>
        </navgroup>
</navgroups>

Then Top-Link Forums & Moderators will be the first link in Navgroup Forums & Moderators (Displayorder: 60).

To find out the Displayorder for existing groups, take a look at cpnav_vbulletin.xml.


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">
                        <text>Top-Link Forums & Moderators</phrase>
                        <link>demohack.php?do=foo</link>
                </navoption>

i find it confusing .. or it's just a typo :D

merk 07-01-2005 10:13 PM

Its a typo.

Andreas 07-01-2005 10:40 PM

Jep. That happens when you just "blindly" write "Code" without testing it ;)
Fixed.

Cloudrunner 07-02-2005 08:50 PM

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....


All times are GMT. The time now is 02:13 AM.

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.01290 seconds
  • Memory Usage 1,752KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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