## ## Document History ## ## Created (peeje01) ## 27-Apr-1999 (peeje01) ## Change include file name from -h.html to _h.html ## 02-Apr-2004 (fanra01) ## Bug 112091 ## Editorial changes from griel02. ## Creating Automatically-Generated Hyperlinks

Creating Automatically-Generated Hyperlinks

This example is a simple variation of the previous one, using hyperlinks in place of a combo box. To do this, we replace the SELECTOR keyword with the LINKS keyword. This automatically generates the HTML tags to create a hyperlink for each row and pass a variable to the target page. The name of the variable is that of the selected column and the value is the contents of the column for that row.

In addition, we set a return address for the following page so that it can link back to this one. That way, we can use the same sub page from more than one place, creating in effect a doubly linked list albeit with only two members.

File: play_typeLink.html

<html>
<head>
<title>Hyper Link to Shakespeare's Plays by type</title>
</head>
<body>
<h1>Hyper Link to Shakespeare's Plays by type</h1>

<!-- #ICE REPEAT INCLUDE=`plays[play_TxnCndCmt_h.html]` -->

<!-- #ICE 
          DATABASE = `icetutor` 
          SQL=`select distinct type from plays` 
          TRANSACTION=`t_type` 
          CURSOR=`c_type` 
          ROWS=`10` 
          TYPE=`PLAIN`
          LINKS=`type,/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]`
          -->
<!-- #ICE COMMIT=`t_type` -->

<!-- #ICE DECLARE=`session.e_return=play_typeLink.html` -->

<!-- #ICE REPEAT INCLUDE=`plays[play_SessionControl_h.html]` -->
</body>
</html>

The required tags to generate the hyperlinks (one per row) are generated by the LINKS keyword as follows:
LINKS=`type,/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]`
The first parameter, type, specifies the column name. This sets the name of the variable that will be passed to the target document. The second argument specifies the document that is the target of the link. This construct produces the following hyperlinks given the contents of the plays table:

<A HREF="/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=comedy">comedy</A>
<A HREF="/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=history">history</A>
<A HREF="/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=tragedy">tragedy</A>

We next declare a new session variable e_return because the next few examples use the same page to list the required plays and we would like to return to the current document. Therefore the variable takes on the value play_typeLink.html which is the name of this document:
<!-- #ICE DECLARE=`session.e_return=play_typeLink.html` -->

We next examine the document that is the target of all three generated links from this document.