Skip to end of metadata
Go to start of metadata

Using the PHP functions LBWeb::header or LBWeb::pagestart, it is possible to add a customized navigation bar to your plugin. The navigration bar can be used for internal and external links, and also can show notification bullets. With the navigation bar it is very easy to split up settings to multiple pages. 

You can use the integrated navbar feature, or can customize your own code. Both ways use the variable $navbar.

PHP (loxberry_web.php)

In your code create a variable called $navbar and customize the elements of your navigation bar. This must be done before you call LBWeb::pagestart or LBWeb::lbheader.

Define array
$navbar[1]['Name'] = "First Menu";
$navbar[1]['URL'] = 'index.php';

$navbar[2]['Name'] = "Second Menu";
$navbar[2]['URL'] = 'second.php';

$navbar[3]['Name'] = "External Website";
$navbar[3]['URL'] = '';
$navbar[3]['target'] = '_blank';
// Activate the second element
$navbar[2]['active'] = True;

The numbers define the ordering of your menu elements. They don't need to be continuously (it is possible to use 10, 20, 30 to keep space for new elements).

The NavBar can integrate notification bullets. What it does, you can see in the Updates system widget: It displays the notifications for new available versions in the menu "LoxBerry Update", and newly installed versions in "LoxBerry Update History".

Here is the example code:

Use notification bullets
$navbar[1]['Name'] = "First Menu";
$navbar[1]['URL'] = 'index.php';
$navbar[1]['Notify_Package'] = LBPPLUGINDIR;
$navbar[1]['Notify_Name'] = 'cronjob';

$navbar[2]['Name'] = "Second Menu";
$navbar[2]['URL'] = 'second.php';
$navbar[2]['Notify_Package'] = LBPPLUGINDIR;
$navbar[2]['Notify_Name'] = 'daemon';

$navbar[3]['Name'] = "External Website";
$navbar[3]['URL'] = '';
$navbar[3]['target'] = '_blank';
// Activate the second element
$navbar[2]['active'] = True;

If you omit the Notify_Name parameter, all notifications of your plugin are counted.

Name(error)The text that is displayed (multilingual labels may use $L['YOUR.LANGSTRING_FROM_TRANSLATION'])
URL(error)An internal or external URL to use, e.g. a link to your second settings page, or to the LoxWiki.
The link target. (HTML target= tag). If omitted, it is opened in the same window, or use "_blank" to open a new window
active( (error) )

If it is True, that button is highlighted (see screenshot above)

The active element must be set to True, otherwise the button is not highlighted.


This defines that the notification bullets should be shown on that tab.

Notify_Package usually is $lbphomedir or the constant LBPHOMEDIR


Defines/filters the notification by the notification name.

If you provide a Notify_Package but no Notify_Name, all notifications for your plugin are counted.

In that case you define the $navbar code yourself. If $navbar is a string (not an array), the template system will completely take your code and pastes it on top of the template.

The NavBar code looks somehow like this:

HTML code for Navbar
<div data-role="navbar">
		<li><a href="#">First</a></li>
		<li><a href="#" class="ui-btn-active">Second</a></li>
		<li><a href="#">Third</a></li>

Of cource, the notification bullets are not shown in that NavBar.

  • No labels