[INET'99] [ Up ][Prev][Next]

Enabling Better Land Use in East Africa: The Story So Far

Michael HAILU <m.hailu@cgiar.org>
Elke DELVOYE <e.delvoye@cgiar.org>
Greg AGOLA <g.agola@cgiar.org>
International Centre for Research in Agroforestry
Kenya

George MUNROE <george@unite.co.uk>
Unite Solutions
United Kingdom

Abstract

We describe a website 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 website features with an emphasis on how 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.

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. That is the situation 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 a level that 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 centers 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 multidisciplinary and full stakeholder participation. AHI is a collaborative research program, bringing together national research organizations, international centers, extension agencies, nongovernmental organizations, 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 interinstitutional collaboration with strong community participation.

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 website, 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 website 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 website as part of an organization's core business.

Report outline

The following sections of this paper provide an account of the AHI website development, from the circumstances that led 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 website was felt to be important. The role of the International Centre for Research in Agroforestry (ICRAF) is described, as are the specific requirements for the AHI Web that ICRAF formulated.

The AHI site is next described with an overview of the final site, followed by more detailed accounts of the underlying principles involved, such as cascading stylesheets, separation of content and navigation, file organization, and 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 website. This section 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 website work, from initial reactions of those using the site, to ongoing monitoring of use, training requirements, and maintenance effort. Finally, a conclusions section summarizes the benefits of completing this work. Miscellaneous comments that others may find helpful have been added.

The African Highlands Initiative

Vision

The first document of the first section on the AHI website 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 centers, 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 chosen as the research centers. 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, both for 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 characterizing farming systems and corresponding groups; publishing and promoting awareness of the findings of collaborative research; and encouraging ongoing partnerships between local and regional groups. Some of the guidelines and recommendations leading from the research work have included, for example, the following developments in common farming practice:

To realize the full benefit of these results, the information must be conveyed to as many relevant individuals as possible. The Internet provides an ideal medium for reaching across national and social boundaries. A website 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 centers throughout the tropics committed to improving human welfare and environmental resilience through agroforestry research. The Nairobi headquarters is the convening center for AHI. Much of ICRAF's work is part of AHI, and ICRAF has been charged with overall coordination.

The design of a website, independent of the main ICRAF website, 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 in October 1998, George Munroe was engaged as a consultant to assist in the design and implementation.

Website requirements

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

Website 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 the latest news items worthy of attention. The screen layout is essentially the same for every other screen within the site.

Figure 2

Figure 2. AHI website home page

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

The Introduction section gives the reader a comprehensive summary of the goals of AHI, a list of the people and organizations 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 programs established in each.

Information about specific benchmark locations, the countries involved, and why these locations were chosen as the remote research centers 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 colors ensures that the pictures used for first pages of a section 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 that did not support frames. With frames the interface becomes much easier to use since reference navigation points are always onscreen. It also means that content pages can be uncluttered from additional HTML (hypertext markup language) 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 that 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 colors, fonts, and sizes by editing a single file. However, if a browser does not support CSS, the site is still fully functional, though style characteristics will revert to default values.

Java was not seen as 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 website

Frame 1 is loaded only 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 center 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 loaded only once during a normal browser session and contains the static main navigation bar for selecting main sections of the website 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. With 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 website

Databases

The Web server host at ICRAF also contains several databases that 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 organization

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; and 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 that Access can import and thus provide the same information in a more useful accessible manner.

For the purposes of the AHI website, 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 that has requested that page. No additional software, plug-ins, or extensions 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 can be built to provide very efficient searching of any or all of the website. 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 website contains subsections for several databases. Within each subsection there are options for Browse, Search, and Update. When selected, each of these options corresponds 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 (uniform resource locator) of the link to that file, such as 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 that 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 that generates this output is listed in Appendix A. It queries the corresponding database table to first determine what data fields are available, then presents these to the user for selection and requests 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 that produces this output is listed in Appendix B.

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 screen would contain many more items than would be selected for the browse output of figure 6. The CF script that generates this for all databases is listed in Appendix C.

Figure 7

Figure 7. Example screen showing details of one selected database record

The one file that has not been kept generic is the initial page used to accept updates to one of the databases. At this stage it seemed preferable to make each one of these contain customized 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 unauthorized 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 have been entered.

Evaluation

Feedback

We plan to gather comments about the AHI website from all AHI research centers. These comments will be used to improve both the interface and content relevance on an ongoing basis. The following summarizes the feedback from ICRAF staff involved in AHI:

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 organization of files, the navigation system, and 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 website is carried out by ICRAF staff in Nairobi. An intranet, based on Microsoft 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 disk 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 website. 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 in 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 act as placeholders for whatever graphical content is desired.

In all cases a consistent subdirectory and naming convention makes the information organization 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 program. This proved to be an effective method of introducing a beneficial website within months.
  2. The most difficult aspect of producing the website was not authoring Web pages, but identifying what information was available and what was relevant. Lessons for all: Disciplined information management does not begin with website design but should be already in place; however, very often website creation can identify where more information order is required and consequently drive significant streamlining of information processing within the organization.
  3. Website 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. For instance, easy-to-follow brochure pages 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 website [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

A. 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>

B. 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#&amp;field=#field#&amp;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>

C. 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>

[INET'99] [ Up ][Prev][Next]