Enabling better land use in East Africa

The story so far

Michael Hailu (m.hailu@cgiar.org)
ICRAF, United Nations Avenue, PO Box 30677, Nairobi
Kenya

Elke Delvoye (e.delvoye@cgiar.org)
ICRAF, United Nations Avenue, PO Box 30677, Nairobi
Kenya

Greg Agola (g.agola@cgiar.org)
ICRAF, United Nations Avenue, PO Box 30677, Nairobi
Kenya

George Munroe (george@unite.co.uk)
UNITE Solutions, Edgewater Road, Belfast BT3 9JQ,
UK


Abstract

We describe a web site for the African Highlands Initiative (AHI), a collaborative research network on natural resources management involving several scientists in eastern and central Africa, with comment for any project designed to coordinate activities and facilitate information exchange in a developing region. Networked scientists at remote locations, with access to the internet, are able to access (and update as necessary) database resources stored centrally. Results of research are published by each site onto the world wide web so that farmers in central and east Africa can benefit from recommendations using direct or indirect (via an intermediate party) internet access. This paper describes AHI web site features with an emphasis on how the 'Cold Fusion' software is used to provide a generic interface to any Microsoft Access database. The paper also records the initial feedback from those working in the larger AHI project.
[Keywords: natural resources management, information exchange, updating, simple databases, web interfaces, Cold Fusion, Microsoft Access, people.]


Table of Contents

Introduction

Background

As we approach the next millennium, poverty, food insecurity and environmental degradation continue to be the most critical development challenges facing African countries. The situation is no different in the highlands of east and central Africa where high population pressure, resource degradation and civil strife are threatening the survival of millions of people.

The east African highlands are heavily populated because of their medium to high agricultural potential and their suitability for human habitation. However, the natural resource base has been seriously threatened and agricultural productivity has stagnated to the level that it can no more sustain the rapidly growing population in the region.

The African Highlands Initiative (AHI) was started in response to concerned national research institutes and international centres that expressed the need to change research and development approaches and partnerships. The new approach requires that research on agricultural productivity incorporate natural resources management to provide the necessary framework for pertinent multi-disciplinary and full stakeholder participation. AHI is a collaborative research program, bringing together national research organizations, international centres, extension agencies, NGOs (Non Governmental Organisations) and farmers groups, to focus on the issues of natural resource management in the highlands of east and central Africa. The overall goal of AHI is to improve the nutritional security and income derived from agricultural activities in communities in the intensively cultivated highlands. This is being achieved through inter-institutional collaboration with strong community participatio! n.

In addition to research activities, an important component of AHI focuses on technology transfer, information gathering and dissemination. Central to AHI's philosophy is the need to enable rural communities to manage their resources effectively by providing them with technological options and information for better decision making at household and community levels. Therefore, the success of AHI will depend to a large extent on its ability to facilitate information flow among farmers, researchers, extension workers, policy makers and other partners involved in technology generation, adaptation, adoption and implementation.

This paper describes a real project. Results of AHI's work can be consolidated within a web site, sharing pertinent information with all the coworkers of the project, and disseminating the results to the rest of the world, including the many sponsors without whose support the work could not continue. The purpose of this paper is to share the experience of introducing the AHI web site so that:

It is believed that the INET conference is one of the most appropriate channels for promoting awareness of the benefits and realistic possibilities of using a web site as part of an organisation's core 'business'. Hence the application to present our report at INET99.

Report outline

The following sections of this paper provide an account of the AHI web site development, from the circumstances which lead to its conception to initial evaluation of the site.

We first detail the nature of AHI results, the coordination of the work and the reasons why the preparation of a web site was felt to be important. The role of the International Centre for Research in Agroforestry (ICRAF) is described, and the specific requirements for the AHI web which ICRAF formulated.

The AHI site is next described with an overview of the final site, followed by more detailed accounts of the underlying principles which were involved, such as cascading stylesheets, separation of content and navigation, file organisation, restrained use of javascript.

A separate section is then included on how Cold Fusion (CF) was used to fully integrate Microsoft Access databases in the web site. This includes nominal background information about both CF and Access.

Since we regard measurement of the effectiveness of the web work as very important, we then discuss aspects of the formative evaluation of the web site work, from initial reactions of those using the site, to ongoing monitoring of use, training requirements, and maintenance effort. [At this stage (February 1999) much of this is 'sketchy' since the full roll out of the site cannot occur until March 1999. However it is fully expected that useful reports will be included for the final version of this paper.]

Finally, a conclusions section summarises the benefits of completing this work. Miscellaneous comments have been added which others may find helpful.

The African Highlands Initiative

Vision

The first document of the first section on the AHI web site is entitled 'Vision' and states the following:

"The African Highlands Initiative aims to ameliorate poverty and food and nutritional insecurity, and related social and environmental problems. This is to be achieved through provision of appropriate natural resource management technologies and policies that ensure improved and sustainable land productivity and use efficiency in the context of natural resource management perspective..."

In order to progress this vision a significant amount of collaboration and cooperation is required between a large number of international research centres, government agencies in different countries, research workers in the field and, not least, farmers themselves.

Figure 1 illustrates the five countries involved in the initiative and the benchmark locations which were chosen as the research centres. As the reader may well imagine, project management and coordination is a challenging activity.

Figure 1

Figure 1
Benchmark locations involved in AHI


The difficulties associated with large scale coordination can be considerably alleviated by using the internet as a communication channel, for both receiving input to decision making, and for 'publishing' the outcome of decision making and other information generating processes, to a large number of collaborators at one time.

Results

AHI has been achieving results by: characterising farming systems and corresponding groups; publishing and promoting awareness of the findings of collaborative research; encouraging ongoing partnerships between local and regional groups. Some of the guidelines and recommendations leading from the research work has included, for example, the following developments in common farming practice:

In order to realise the full benefit of these results, it is important that the information is conveyed to as many relevant individuals as possible. The internet provides an ideal medium for reaching across national and social boundaries. A web site is accessible as many times as necessary for reference purposes, once a means of direct or indirect access has been established.

ICRAF

The International Centre for Agroforestry Research [1] in Nairobi is one of several ICRAF centres throughout the tropics committed to improving human welfare and environmental resilience through agroforetry research. The Nairobi headquarters is the convening centre for AHI. Much of ICRAF's work is part of AHI and ICRAF has been charged with overall coordination.

The design of a web site, independent of the main ICRAF web site, was proposed by ICRAF, where staff, such as Michael Hailu, were very aware of the potential benefits an AHI site would bring to the work. A preliminary specification was prepared for the site and during October 1998, George Munroe was engaged as a consultant to assist in the design and implementation.

Web site requirements

The following requirements were included in the initial specification of the AHI web site:

Web site design principles

Overview of site

Figure 2 shows the home page of the final AHI site [2]. The four main sections and site search may be selected from the main navigation bar at the top right. On selecting a main section, a subsection menu appears on the left of the screen at the same time that the section name replaces the 'Welcome to AHI' text on the top right and the main part of the screen changes to the first page for that section. The home page of the site provides all essential contact details and a scrolling 'marquee' with latest news items worthy of attention. The screen layout is essentially the same as with every other screen within the site.

Figure 2

Figure 2
AHI web site home page


Each main section first page contains a characteristic image, relating to some aspect of the African highlands. This remains on screen while a subsection is selected on the left to reveal a 'drop-down' list of the documents available within that subsection. On selecting one such document, the main part of the screen is used to display that document using a 'watermark' version of the section first page image as a backdrop.

The Introduction section gives the reader a comprehensive summary of the goals of AHI, the people and organisations involved (including main donors), a glossary of terms and similar background introductory material.

The Programme section focuses on the actual work being done and the results that are being delivered, with details of AHI phases one and two, and the research programmes established in each.

Information about specific benchmark locations, the countries involved, and why these locations were chosen as the remote research centres, is contained in the Locations section.

Possibly the most 'interesting' section is Resources which contains links for browsing, searching and updating several databases, and also a simple photogallery with a selection of images from the five AHI countries.

Selecting Search invokes a simple search screen for the supply of keywords. On submission an index of the free text of all content pages is used to return a list of all the documents containing the keywords; each item of the list is a link to the actual document it refers to.

Speed of access and compatibility

Graphics have been used to provide the desired visual effect. However all navigation 'buttons' on both the top bar and menus on the left of the screen, are simply text in table cells. This avoids longer page download times caused by unnecessary graphics. Careful graphical editing to reduce unnecessary colours etc. ensures that the pictures used, for section first pages, are as small (size in Kb) as possible.

It was decided that the advantages of using 'frames' outweighed the possible disadvantage of a small number of users having an outdated browser which did not support frames. With frames the interface becomes much easier to use since reference navigation points are always on screen. It also means that content pages can be uncluttered from additional HTML structures which would otherwise be required to assist navigation; as a consequence, moving between different pages of the site is faster.

Cascading stylesheets (CSS) [3] have been used to control the 'style' appearance of all pages on the site. Every page has a link to the same stylesheet file which defines different classes of HTML structures used in individual pages. The net result is that the whole site appearance is consistent and may be modified with respect to colours, fonts, sizes etc. by editing a single file. However if a browser does not support cascading stylesheets the site is still fully functional, though style characteristics will revert to default values.

Java was not felt necessary for any part of the site. However simple Javascript [4] routines have been used to enhance the interface by, for example changing the contents of several frames upon a menu selection. As with CSS the site will remain fully functional with a browser that does not support Javascript.

Screen layout

Figure 3 shows the 'borderless' frames making up the familiar screen layout shown in Figure 2. Each frame has a well defined purpose and the mix of frames was chosen to provide optimum web server response and division of information content, navigation, and functional 'decoration'.

Figure 3

Figure 3
Layout of frames on all pages of AHI web site


Frame 1 is only loaded once during a normal browser session and provides the AHI logo at the top left of the screen at all times. The logo image is also a link back to the home page.

Frame 2, at the centre top of screen, changes every time a new section is chosen from the main navigation bar. A small file containing one line of text is loaded into this frame and indicates the name of the currently selected main section.

Frame 3 is only loaded once during a normal browser session and contains the 'static' main navigation bar for selecting main sections of the web site and the site search.

Frame 4 is the area used to navigate through each main section. The displayed menu is changed whenever a different main section is chosen and whenever a subsection within that main section is chosen.

Finally Frame 5 is the main information content area. Documents are loaded into this frame when an option under a subsection heading in Frame 4 is selected.

Navigation

User navigation of the whole site is by ('button') selection at three different levels, illustrated in Figure 4.

  1. Main sections and the search facility are chosen from the static navigation bar in Frame 2 (e.g. Introduction in Figure 4).
  2. Subsections are chosen from a menu presented in Frame 4 following main section selection. Using standard graphical user interface convention, each subsection title is appended with an ellipsis (...) to indicate that it is a link to further choices (e.g. Goals... in Figure 4).
  3. Upon selection of a particular subsection (by clicking on it) the documents contained therein are listed under the subsection name and loaded into Frame 5 when clicked (e.g. Vision or Objectives in Figure 4).

Figure 4

Figure 4
The three levels of navigation used throughout the AHI web site


Databases

The web server host at ICRAF also contains several databases which should be made as available as possible to ordinary web browsers. This has been made possible using the Cold Fusion server software, running on the server host, to interpret special embedded tags in some of the Resources section web pages, to read or write to database files dynamically.

File organisation

Management of the site is kept simple by using a similar subdirectory structure for each main section. File names within each subdirectory, which serve the same purpose in each main section, are given the same name so that any scripting can be as generic as possible, ensuring both consistency and error free operation. Also relative paths are used for references to, for example, images (kept in a separate directory) and, with the subdirectory structure chosen, these pathnames are always the same. This makes it easy to reuse existing files as templates for new documents, especially when extending the navigation menus.

Use of Access and Cold Fusion

Microsoft Access database

Microsoft Access [5] is one of the most popular database packages used today. It now incorporates SQL (system query language), the universally accepted standard for querying databases, and has full support for ODBC (open database connectivity), which enables databases on a networked server to be accessed from elsewhere on the network.

Within the AHI project simple Access database tables are used to store records of, for example: contact details; publications; useful links to other resources; related project details; relevant bibliographic material. Much of the 'data' had previously been stored using the widely used ISIS package. However with a little patience it is possible to export ISIS data in a format which Access can import and thus provide the same information in a more useful accessible manner.

For the purposes of the AHI web site, all database tables are contained within one Access database file and particular web pages in the Resources section use Cold Fusion routines to select a particular table and a selection of the records according to user specified criteria.

Making the Access database available in this way does not prevent normal use for the purposes of editing or updating using Access itself.

Allaire Cold Fusion

Allaire's Cold Fusion (CF) package [6] is used to enable seamless interoperability between web pages and databases. Behind the scenes CF composes SQL statements, sends these to the database using ODBC (or similar standard protocol), and provides a wide range of options for formatting and presenting the resulting output within a web page.

CF runs as an extension of the web server and preprocesses embedded <cf...> tags in the HTML source of a web page to acquire database information and format it, before the page is returned to a browser which has requested that page. No additional software, plugins or extensions of any kind are required at the browser end; all necessary processing is carried out on the server.

CF also contains the 'Verity' search engine. Collections of database queries or free text contained within web pages can be established, and indexes for these collections built to provide very efficient searching of any or all of the web site. We have used this to provide both the site search, available from the top navigation bar, and individual database searches, within the Resources section.

Dynamic web pages

The Resources section of the web site contains subsections for several databases. Within each subsection there are options for Browse, Search and Update. When selected, each of these options coresponds to exactly the same file in every database subsection. The only difference is that the name of the particular database table is passed as a variable on the URL of the link to that file, e.g. for the Browse option in the Projects subsection, using a construct such as:

<a href="browseMaster.cfm?databaseTable=Projects">Browse</a>

Thus generic files (CF scripts) have been written to handle the browser to databases interface, and these can be simply applied to any other Access (or similar) database which may be included at a later date.

Figure 5 illustrates, as an example, the results of selecting the Browse option in the Useful links subsection. The CF script which generates this output is listed in Appendix 1A. It queries the corresponding database table to first determine what data fields are available, then present these to the user for selection and request a sorting order.

Figure 5

Figure 5
Example screen on selecting a 'browse' option for any of the databases


Figure 6 shows what happens once the user submits the form shown in Figure 7. An appropriate request is sent to the database by the CF software on the server and an HTML table containing the fields chosen on the previous screen, for each record in the database, is returned to the browser window. Within the table any URLs are automatically 'marked up', so that they can be visited with a simple 'click'. The first field shown is also a link to the full details available in the database for the corresponding record. The CF script which produces this output is listed in Appendix 1B.

Figure 6

Figure 6
Example screen showing report screen after choosing database browse parameters


Figure 7 is an example screen showing the full details of one record (selected by clicking first field of output shown in Figure 6). In general this would contain many more items than would be selected for the browse output of Figure 6. The CF script which generates this for all databases is listed in Appendix 1C.

Figure 7

Figure 7
Example screen showing details of one selected database record


The one file which has not been kept generic is the initial page used to accept updates to one of the databases. At this stage it was felt that it was preferable to make each one of these contain customised comments relating to the fields to be supplied, so that helpful information is presented to the user. Figure 8 shows a very simple example, the Update option for the Useful links subsection.

Figure 8

Figure 8
Example screen showing database update form


In order to prevent unauthorised updating, password protection has been implemented on all the initial update pages. An interface such as that in Figure 8 cannot be accessed unless a valid username and password has first been entered.

Evaluation

Feedback

We plan to gather comments about the AHI web site from all AHI research centres. These will be used to improve both the interface and content relevance on an ongoing basis. At this stage the following summarises the feedback from ICRAF staff involved in AHI [this will be supplemented in the final version of the paper]:

Statistics

As the AHI site is promoted within the AHI community and elsewhere, access statistics will be used to identify exactly who is using it. This information will be used to determine where difficulties may be arising and to measure the effectiveness of follow-up actions.

Training

Training is planned at two levels:

  1. Those involved in the ongoing 'core' maintenance of the site require a comprehensive briefing on the organisation of files, the navigation system, procedures for extending the site.
  2. Users of the site require an introduction to connecting to the internet and using a browser. An appreciation of the importance of adding accurate and complete information to the databases is also desirable.

Maintenance

Maintenance of the web site is carried out by ICRAF staff in Nairobi. An intranet, based on MS Windows NT, provides each staff machine with a graphical interface to files on other desktop and server machines on the local network. The AHI site maintainers have access to the web server so that site files can be modified in the same way that files on the local hard disc can be edited.

Updating content pages (which always appear in Frame 5, Figure 3) involves text editing of HTML pages. However this can be done quite straightforwardly with any editor since the content pages have been kept quite separate from the navigation HTML. Generally there are only '<p>' tags to contend with when editing.

Adding a new 'leaf' section (i.e. the last or third level of structure) is anticipated to be the most common extension of the web site. This requires only an addition to one navigational HTML file (which appears as an expanded menu in Frame 4, Figure 3) to add the new link, then placement of the new content file in the appropriate subdirectory of the server.

When adding a new subsection (second level) a number of files must be edited to include a link to that subsection on all navigational HTML pages (which appear as closed and expanded menus in Frame 4, Figure 3) associated with the corresponding main section.

A complete new main section is added by editing the common first level navigation 'bar' (which appears in Frame 3, Figure 3), then including a new subdirectory with a file structure exactly the same as with the other main section subdirectories.

Updating graphics is simply a matter of replacing existing files with new files of the same name. The '<img>' tags within the web page HTML source, acts as a placeholder for whatever graphical content is desired.

In all cases a consistent subdirectory and naming convention makes the information organisation easy to follow and modification or extension of the site a simple process, after a short period of training.

Conclusions

Summary of benefits

We believe the following have now been established, all of which bring new or improved means of coordination, administration and promotion of AHI work:

Miscellaneous comments

  1. A special donor grant ($10K) allowed the development of the AHI site as a separate activity within the AHI programme. This proved to be an effective method of introducing a beneficial web site within a matter of months.

  2. The most difficult aspect of producing the web site was not authoring web pages, rather identifying what information was available and what was relevant. Lessons for all: disciplined information management does not begin with web site design but should be already in place; however very often web site creation can identify where more information order is required and consequently drive significant streamlining of information processing within the organisation.

  3. Web site preparation always takes longer than expected; it is inevitably a process of refinement to match the corresponding 'business' goals. In the case of AHI more overt invitations for local farmers and groups to participate are expected to be introduced, to draw the local audience into useful dialogue, rather than simply 'broadcast' information. However even the broadcast information may be modified for easier use by those acting as agents in communicating the web based information to those who do not have ready internet access, e.g. in the form of easy to follow brochure pages which could be printed in numbers from the web and distributed to give clear instructions to farmers on how to introduce new methods.

References

  1. ICRAF home URL, http://www.cgiar.org/icraf/
  2. AHI web site [the ICRAF based site is awaiting CF upgrade, this site is temporary], http://discovery.unite.net/ahi/
  3. Cascading Stylesheets, World Wide Web Consortium latest guidelines, http://w3c.org/Style/
  4. Javascript, working draft giving comprehensive overview, http://www.w3.org/TR/WD-script-960208.html
  5. Microsoft Access database software, http://www.microsoft.com/office/97/access/brochure/
  6. Allaire Corporation's home page and information about Cold Fusion, including 30 day evaluation packages, http://www.allaire.com/

Appendix 1

1A Generic CF4 script for displaying database fields

(see Figure 5 for example output)

<!--- ======================================================= ---> <!--- browseMaster.cfm ---> <!--- GM, December 1998 ---> <!--- ======================================================= ---> <!--- generic display of selected database elements ---> <!--- important note about database preparation: ---> <!--- 1 all database field names must begin with four ---> <!--- characters which are used to sort the names for ---> <!--- display purposes; the first of these four ---> <!--- characters must be a letter (suggest A); the ---> <!--- first four characters will not be displayed when ---> <!--- database field names appear on screen ---> <!--- ======================================================= ---> <cfset databaseTable=#URL.databaseTable#> <cfquery name="browse" datasource="AHI"> SELECT * FROM #databaseTable# WHERE 0=0 </cfquery> <cfset fieldNames=browse.columnlist> <cfset fieldNumber=listlen(fieldNames)> <cfset fieldHalfArray=arraynew(1)> <cfset fieldHalfArray=listtoarray(fieldNames)> <cfset fieldNamesSorted=arraysort(fieldHalfArray, "text", "asc")> <cfset fieldArray=arraynew(2)> <cfset fieldArray[1]=fieldHalfArray> <cfloop index="n" from="1" to=#fieldNumber#> <cfset fieldArray[2][n]=removechars(fieldArray[1][n], 1, 4)> </cfloop> <!--- Start of html ---> <html> <head> <title>Database browsing</title> <meta name="Subject" content="Agroforestry"> <meta name="Author" content="ICRAF"> <meta name="Keywords" content="contacts publications bibliography projects links"> <link rel=stylesheet href="../css/ahi.css" type="text/css"> </head> <body class="resources"> <h2><cfoutput>#databaseTable#</cfoutput></h2> <center> <form action="displayMaster.cfm" method="post"> <cfoutput><input type="hidden" name="databaseTable" value="#databaseTable#"></cfoutput> <input type="hidden" name="selectedFields_required" value="You must select at least one field!"> <input type="hidden" name="sortField1_required" value="You must select a first sort field!"> <table border="0" cellpadding="5" cellspacing="0" width="95%"> <tr> <td colspan="5"> Database fields in column 1 are available. Use 'selection boxes' in column 2 to select fields to be included in the records you are about to view. Use 'radio buttons' in columns 3, 4, and 5 to specify first, second and third fields by which records should be sorted before viewing. </td> </tr> <tr> <th valign="top">1<br>Database fields</th> <th valign="top">2<br>Included in display</th> <th valign="top">3<br>First sort field</th> <th valign="top">4<br>Second sort field</th> <th valign="top">5<br>Third sort field</th> </tr> <cfloop index="n" from="1" to=#fieldNumber# step="1"> <tr> <cfoutput> <td align="right">#fieldArray[2][n]#</td> <td align="center"><input type="checkbox" name="selectedFields" value="#fieldArray[1][n]#"></td> <td align="center"><input type="radio" name="sortField1" value="#fieldArray[1][n]#"></td> <td align="center"><input type="radio" name="sortField2" value="#fieldArray[1][n]#"></td> <td align="center"><input type="radio" name="sortField3" value="#fieldArray[1][n]#"></td> </cfoutput> </tr> </cfloop> <tr> <td colspan="5" align="left"> <input type="submit" value="Display records"><input name="Reset" type="reset"> </td></tr> </table> </form> </center> </body> </html>

1B Generic CF4 script for displaying database contents

(see Figure 6 for example output)

<!--- ======================================================= ---> <!--- displayMaster.cfm ---> <!--- GM, December 1998 ---> <!--- ======================================================= ---> <!--- generic display of selected database elements ---> <!--- important note about database preparation: ---> <!--- 1 all database field names must begin with four ---> <!--- characters which are used to sort the names for ---> <!--- display purposes; the first of these four ---> <!--- characters must be a letter (suggest A); the ---> <!--- first four characters will not be displayed when ---> <!--- database field names appear on screen ---> <!--- ======================================================= ---> <cfset fieldNames=#FORM.selectedFields#> <cfset databaseTable=#FORM.databaseTable#> <cfset sortArray=arraynew(1)> <cfloop index="n" from="1" to="3"> <cfset sortField="FORM.sortField#n#"> <cfif isdefined(#sortField#)> <cfset sorter=arrayappend(sortArray, #evaluate(sortField)#)> </cfif> </cfloop> <cfset sortFields=arraytolist(sortArray, ",")> <cftry> <cfquery name="browse" datasource="AHI"> SELECT #fieldNames# FROM #databaseTable# WHERE 0=0 ORDER BY #sortFields# </cfquery> <cfcatch type="database"> <cfoutput><hr> <p><b>Whoops!</b></p> <p>The particular database system being used doesn't allow this...</p> <p>(Most likely you've selected a sort field which is of type 'memo'. Suggest you try a different sort field.)</p> <p>Use the browser 'back' button and try again!</p> <hr></cfoutput> <cfabort> </cfcatch> </cftry> <cfset fieldNumber=listlen(fieldNames)> <cfset fieldHalfArray=arraynew(1)> <cfset fieldHalfArray=listtoarray(fieldNames)> <cfset fieldNamesSorted=arraysort(fieldHalfArray, "text", "asc")> <cfset fieldArray=arraynew(2)> <cfset fieldArray[1]=fieldHalfArray> <cfloop index="n" from="1" to=#fieldNumber#> <cfset fieldArray[2][n]=removechars(fieldArray[1][n], 1, 4)> </cfloop> <!--- Start of html ---> <html> <head> <title>Database browsing</title> <meta name="Subject" content="Agroforestry"> <meta name="Author" content="ICRAF"> <meta name="Keywords" content="contacts publications bibliography projects links"> <link rel=stylesheet href="../css/ahi.css" type="text/css"> </head> <body class="resources"> <h2><cfoutput>#databaseTable#</cfoutput></h2> <center> <table border="1" cellpadding="5" cellspacing="0"> <tr> <cfloop index="n" from="1" to=#fieldNumber#> <cfoutput><th>#fieldArray[2][n]#</th></cfoutput> </cfloop> </tr> <cfloop query="browse"> <cfset field=fieldArray[1][1]> <cfset fieldLabel=fieldArray[2][1]> <cfoutput> <tr><td><a href="detailsMaster.cfm?databaseTable=#databaseTable#&field=#field# &fieldValue=#URLEncodedFormat("#evaluate(field)#")#">#evaluate(field)#</a><br></td> </cfoutput> <cfloop index="n" from="2" to=#fieldNumber#> <cfset field=fieldArray[1][n]> <cfset fieldLabel=fieldArray[2][n]> <cfif #fieldLabel# EQ "URL"> <cfoutput><td><a href="#evaluate(field)#" target="New">#evaluate(field)#</a><br></td></cfoutput> <cfelse> <cfoutput><td>#evaluate(field)#<br></td></cfoutput> </cfif> </cfloop> </tr> </cfloop> </table> </center> </body> </html>

Generic CF4 script for displaying single record

(see Figure 7 for example output)

<!--- ======================================================= ---> <!--- detailsMaster.cfm ---> <!--- GM, December 1998 ---> <!--- ======================================================= ---> <!--- generic display of selected database elements ---> <!--- important note about database preparation: ---> <!--- 1 all database field names must begin with four ---> <!--- characters which are used to sort the names for ---> <!--- display purposes; the first of these four ---> <!--- characters must be a letter (suggest A); the ---> <!--- first four characters will not be displayed when ---> <!--- database field names appear on screen ---> <!--- ======================================================= ---> <cfset databaseTable=#URL.databaseTable#> <cfset field=#URL.field#> <cfset fieldValue=#URL.fieldValue#> <cfquery name="browse" datasource="AHI"> <cfif isnumeric(#fieldValue#)> SELECT * FROM #databaseTable# WHERE #field#=#fieldValue# <cfelse> SELECT * FROM #databaseTable# WHERE #field#='#fieldValue#' </cfif> </cfquery> <cfset fieldNames=browse.columnlist> <cfset fieldNumber=listlen(fieldNames)> <cfset fieldHalfArray=arraynew(1)> <cfset fieldHalfArray=listtoarray(fieldNames)> <cfset fieldNamesSorted=arraysort(fieldHalfArray, "text", "asc")> <cfset fieldArray=arraynew(2)> <cfset fieldArray[1]=fieldHalfArray> <cfloop index="n" from="1" to=#fieldNumber#> <cfset fieldArray[2][n]=removechars(fieldArray[1][n], 1, 4)> </cfloop> <!--- Start of html ---> <html> <head> <title>Database browsing</title> <meta name="Subject" content="Agroforestry"> <meta name="Author" content="ICRAF"> <meta name="Keywords" content="contacts publications bibliography projects links"> <link rel=stylesheet href="../css/ahi.css" type="text/css"> </head> <body class="resources"> <h2><cfoutput>#databaseTable#</cfoutput></h2> <h4>Record: '<cfoutput>#fieldValue#</cfoutput>'</h4> <center> <table border="1" cellpadding="5" cellspacing="0"> <cfloop query="browse"> <cfloop index="n" from="1" to=#fieldNumber#> <cfset field=fieldArray[1][n]> <cfset fieldLabel=fieldArray[2][n]> <tr> <td align="right"><cfoutput>#fieldLabel#</cfoutput></td> <cfif #fieldLabel# EQ "URL"> <cfoutput><td align="left"><a href="#evaluate(field)#" target="New">#evaluate(field)#</a><br></td></cfoutput> <cfelse> <cfoutput><td align="left">#evaluate(field)#<br></td></cfoutput> </cfif> </tr> </cfloop> </cfloop> </table> </center> </body> </html>