Quiz software, teaching tools, exam revision aids, learning games, courseware authoring
Java Menus
Java menu homeJava downloadBuy a java menuJava menu help centreContact us
Java menus » Java menu knowledge base

 SEARCH

 MENUS BY TYPE

 Drop-down menus

 Animated buttons

 Tree menus

 Sliding menus

 Tab menus

 Image maps

 MENUS BY NAME

 X-Bar menus

 iPOP menus

 iSlide menus

 iTree menus

 iTab menus

 iMMap menus

 Sensomap menus

 Magic menus

 MENU DESIGN

 Menu design

 Drop-down menus

 Web buttons

 Tree menus

 Sliding menus

 Menu tabs

 Image maps

 SITE LINKS

 Home

 Java downloads

 Prices / Buying

 Support

 Company

 Contact

 New menus

 Free menus

 PARTNER SITES

 Alien Menus

 Happy Menus
Java menu knowledge base
Cold fusion and dynamic menus
Return to knowledge base directory

 
Contributed by: Ray Rogers, President - Resource Management Systems, Cold Fusion specialists.
 
This article shows you how to use the Cold Fusion programming language to dynamically populate an IMINT index file. I normally use the dynamic index file for 2 purposes:
  • to generate a dynamic menu;
  • to provide a security system by displaying menu sections or items, based on login criteria.
An online demo of the system used for this article is available at www.fdrms.com/menudemo/ - feel free to login using the access information at the site. Add some equipment and see how the entries are instantly added to the dynamic menu. Please report any bugs (there must be a few in there) to me at ray@fdrms.com and I will sort them.
 
Requirements
  • A web server running Cold Fusion, in a Windows environment.
  • A datasource established on the server and registered with the Cold Fusion administrator. I have used a MSAccess database for this demonstration, but most ODBC-compliant databases can be used with Cold Fusion.
  • The scripts accompanying this article - click here to download.
  • An IMINT applet that allows you to specify the name of the index file, which is usually done with the menufile parameter. Trial versions as well as release versions of most applets can be used in this way, so you can practice database retrieval with the applets before buying.
  • An understanding of IMINT's XIXL eXtensible IndeXing Language.
  • An understanding of the Cold Fusion application language.
Strategy
 
In any applet-database retrieval system for IMINT applets, whether you use Cold Fusion or any other language, there are basically three elements involved.
  1. The datasource: located on the server and registered with the system.
  2. The datasource retrieval script: on the server, that collects data from your datasource and creates an index file with dynamic components each time it is called. You will need to write this yourself, for example, by borrowing the scripts from this article and adapting them to your needs. It is here that you can customise in features such as permissions and conditional information retrieval.
  3. The applet: this is on the client and uses the retrieval script to create a menu and clothe it in an attractive and user-friendly interface.
Demonstration Project Scenario
 
The online demonstration shows a local Fire Department system for managing equipment and personnel. There are 3 levels of security - administrator, personnel or operations. The administrator can access all features, where personnel and operations are limited to their own specific areas. Initial display is created without any security structure. The menu items shown are “public”. Once you login to the system the menu items will change to reflect the security level assigned to that login. The demo website gives you a list of different users and their login information to test this process. As an operations manager you can add equipment to the database. As new equipment is added it is instantly reflected in the menu system.
 
Implementation
  1. The database: the sample MSAccess database is here. You will need to register the DSN with the system either through the ODBC routine in Windows or the Cold Fusion administrator. The DSN I have used is menudemo, but of course you can name yours anything you like as long as you change the DSN reference in the sample queries. To make this easy I have included an application.cfm file that specifies an application.dsn variable and assigns it the name menudemo. To change the DSN for the entire application you will only need to make a change to this variable.
  2. The retrieval scripts: the 14 sample CFML scripts from the demo are here. Take a careful look at the commented source code of the menu.cfm file here - this is the file which contains the real basics of building a dynamic menu system using CFML. I have built in some very complex routines to achieve the results I was after. The effect was a very effective, powerful, scalable and cost-effective navigation system. The comments in the source code should enable you to see how this works and adapt it for your own purposes.
  3. The applet: the applet used for this demonstration is X-Bar Powerbar I and you can download the trial version required to run the demo here. You must add the CLASS, CAB and JAR files to the CFM, HTML, CSS and MDB files for the demo to work. The applet can access the database retrieval script at different times during its operation, depending on your needs.
    1. When it first starts. Use the menufile parameter (or with some applets, a different parameter - see instructions) like this:
      <PARAM NAME=menufile VALUE=menu.cfm>
    2. During operation when the user clicks a specific menu item and triggers a new index load. Use the DRILL command like this:
      "TEXT:menu item" "1" "" "DRILL:menu.cfm" "(Load new menu)"
    3. During operation, using a remote javascript control to trigger a new index load (if the applet supports this). Use the drill() method like this: document.myApplet.drill('menu.cfm');
Extra dynamic coding
 
In the demonstration above we have concentrated on the information processed and passed TO the applet. However when you click on a menu item in the applet, the applet naturally then passes a URL request BACK to the server. If you are using CFML, many of the documents which the applet navigates through may themselves be dynamic. You can pass dynamic information THROUGH the applet BACK to the server using query strings as in this example of a section of a XIXL menu item code:
 
"LINK:dsp_PersonnelEdit.cfm?PersonnelID=#PersonnelID#"
 
This will pass a dynamically generated variable (#personnelID#) in a query string, to the dsp_PersonnelEdit.cfm script. The ID number can be used to retrieve the personnel data for the specific person you selected from the menu list.
 
Troubleshooting
 
If you set up everything in the way described and find it doesn't work, you will find it difficult to track down the cause if you just look at the applet on your screen. Probably the applet will just show "error 4", which means it couldn't find any menu, or it may show one of the error codes for an incorrectly formatted index.
 
To make things easier for yourself, you should check the database retrieval script during development by entering the URL used by the applet directly into the browser address bar. If your database retrieval script is written correctly, then a simple text file output should appear in the browser which is identical to a typical XIXL index file. This way you can check the formatting of the index directly.
 
java menu