RB Menu

Derek Jones edited this page Jul 5, 2012 · 8 revisions

Overview

The RB-Menu handles one or more menu bars on your web pages. It supports horizontally or vertically oriented menus optionally showing one level of sub menu items. RB-Menu selects one menu item according to the current request URI. The selected menu item can be highlighted.

The RB-Menu package allows you to setup the menu items and sub items independently from the visual appearance attributes. The loaded instance of the Rb_menu library class stores all these setup data and uses them as soon as menu rendering is requested - usually within a view class.

During rendering RB-Menu checks for each menu item whether it is allowed to be rendered by calling a method of an acl (access control list) library class if such a class is available. Thus the acl library class can control at runtime the visibility of menu items - for example according to a logged-in status of the user.

Further information

Requirements

  • CodeIgniter - I have tested it on 1.7.0 and now 2.1.0 but other versions should work fine too.
  • PHP of course - I have tested it on PHP 4.4.9, 5.2.1, and now 5.3.8 (XAMPP).

See It Run Here you can find a demo site (not yet updated).

Download All files necessary for the RB Menu are here:

Installation and Configuration

  • Unzip the downloaded archive into your CodeIgniter installation. The archive contains sub directories that show where the files have to go.

  • The archive contains example files that show how to implement:

    • an access control library class (libraries/acl.php) that - in this example - distinguishes menu items for users or administrators. Please adapt this for your application.

    • a helper (helpers/menu_helper.php) that configures the menu items for your web site. Please adapt this for your application.

    • a controller (controllers/welcome.php) with RB-Menu support - its constructor loads the url_helper, the menu_helper, the acl library, and defines the menu items. This file shows how to integrate RB Menu.

    • a page header view (views/pageheader.php) that renders the menu. This file shows how to integrate RB Menu.

  • For a detailed description of the methods of the Rb_menu library class please refer to the inline documentation inside the file libraries/Rb_menu.php.

  • The archive also contains an example RB-Menu configuration file (config/Rb_menu.php) that shows which values you can modify to adapt RB-Menu to your web application's visual appearance.

  • If you plan to use sub menu items, you need to load a CodeIgniter Session class since the name of the open parent menu item is stored in the session's user data. Please note, that the standard CodeIgniter Session needs a non-empty 'encryption_key' value (in config/config.php).

  • Parent menu items are marked with a small arrow icon. The associated image files are located in the img directory of the archive. Feel free to choose other icons appropriate to your web design. The names of both icons for the selected and the unselected parent menu item can be configured in config/Rb_menu.php.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.