Home arrow MySQL arrow Page 2 - Data Management Made Easy Using Nennius: Creating a Web Application

Configuring a Web Application and Defining Its Menu - MySQL

Previously, we took a look at the Nennius engine and discussed several out-of-the-box features available to PHP developers. Now we are ready to create our own Nennius web application, and so we will discuss all of the steps necessary to do that.

TABLE OF CONTENTS:
  1. Data Management Made Easy Using Nennius: Creating a Web Application
  2. Configuring a Web Application and Defining Its Menu
  3. Creating SQL Tables
  4. Creating a Nennius Component, Defining the Entry-Point, and the Descriptor File
  5. The Component File
By: Brian Vaughn
Rating: starstarstarstarstar / 10
July 27, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Configuring an Web Application

For the purposes of our example application, our default configuration file will contain the following:

<?php
# name of application
$GLOBALS['nennius_application_name']  = 'News Manager';

# absolute path to current application on web server
$GLOBALS['nennius_application_path']  = '/nennius_server_path/webapps/news/';

# absolute URL to current application
$GLOBALS['nennius_application_url']   = 'http://www.corporatewebsite.com/nennius/webapps/news/';

# Nennius database connection variables - configure to match your SQL setup
$GLOBALS['nennius_db_type']           = 'mysql';     # ex. 'mysql', 'postgresql', 'oracle'

$GLOBALS['nennius_db_ip']             = 'localhost';
$GLOBALS['nennius_db_user']           = 'user';
$GLOBALS['nennius_db_pass']           = 'pass';
$GLOBALS['nennius_db_name']           = 'news';
?>

Defining an Application’s Menu

The next step in creating a Nennius application is defining a menu structure. The menu configuration file ('config.menu.php’) contains two basic variables. The first, $nennius_menu_array, is an array specifying menu category names as keys, which in turn hold child arrays containing menu options for the category in question. Put another way each menu link is a self-describing array, contained by a larger array holding similarly grouped items, which is itself contained by yet another array – $nennius_menu_array.

For the purposes of our sample application, we will create one menu category, "Admin Options", and 2 menu options: “Manage Releases” and “Corporate Website”. Example code for doing this is provided below:

<?php
# include config_defaults file for threshold values

# NOTE: ignore a failed include for the purposes of the admin GUI

@ include_once '../../config.defaults.php';

# intiialize nennius menu array
$nennius_menu_array    = NULL;

# Manage Releases - links to Nennius page for adding & removing news releases
$admin_options_array[]         = ( array(     'menu_display_name'    => 'Manage Releases',
                                      'menu_hyperlink'       => 'index.php',
                                      'menu_threshold'       => $GLOBALS['ADMIN'] ) );

# Corporate Website - links to external corporate website to view changes in realtime
$admin_options_array[] = ( array(     'menu_display_name'    => 'Corporate Website',
                                      'menu_hyperlink'       => 'http://www.corporatewebsite.com/news.php',
                                      'menu_threshold'       => $GLOBALS['PUBLIC'] ) );
                                     
# add all menus to nennius menu array

$nennius_menu_array['Nennius Menu']   = $admin_options_array;

# globalize nennius menu array for access by Display Template
$GLOBALS['nennius_menu_array']        = $nennius_menu_array;
?>

As you can see, each menu item contains several attributes: display name, hyperlink, and threshold. Perhaps the only one of these attributes that may not be self-explanatory upon first examination is the threshold. Nennius allows for 6 basic threshold levels: PUBLIC, CLIENT, USER, REVIEWER, MANAGER, and ADMIN. Every user is assigned a level, and in turn those levels are used to determine what content a user has access to as well as what operations a user may pform on specific content. For purposes of the menu configuration, a threshold level defines the minimum threshold required for a user to view a menu link. In our example above, any user (even one who has not yet logged in) will be able to view the "Corporate Website" link, but only ADMIN users will be able to view the link entitled "Manage Releases".

That's it. We've now defined a basic menu for our 'news' web app. (Note: Nennius will automatically generate 'login' and 'logout' menu options as well when appropriate.)



 
 
>>> More MySQL Articles          >>> More By Brian Vaughn
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

MYSQL ARTICLES

- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: