Adding a hyperlink output element
About hyperlink output elements
A hyperlink output element is an output elementIn a database-driven content block, an element that displays the contents of a single database field or, alternatively, the value of a parameter. that generates hyperlinks from the contents of database fields. The examples below illustrate the difference between ordinary output elements and hyperlink output elements in the “Name” column of a simple table block:
|
|
Ordinary output elements |
Hyperlink output elements |
When you create a hyperlink output element, you specify a base URL that applies to the generated hyperlink for every record, and you also specify a parameter that will be appended to the base URL for every link. Most importantly, you can set the value of this parameter to a variable that represents the contents of a particular database field in the current record. Thus, for example, if the base URL points to a document containing a detail block, the hyperlink generated for each record can pass the ID number of the current record to the destination document and result in that record being displayed in the detail block.
Each link that a hyperlink output element generates has the form:
base_URL?parameter_name=current_value_of_field
where current_value_of_field is the contents of the specified database field in the current record. In the example table block shown above, if the base URL is http://www.example.com/detail.asp, the parameter name is “cid”, the database field providing the parameter value is Customers.ID, and John Humphries’s customer ID number is 291, then the URL of the link for John Humphries would be:
http://www.example.com/detail.asp?cid=291
Clicking the link would open the detail.asp document and pass to it the cid=291 parameter. If detail.asp contains a detail block showing a full record in the Customers database, and the filter condition for the detail block is:
Customers.ID = <a,cid>
then the content of the detail block will be the customer record for John Humphries.
You can add a hyperlink output element to any kind of block except chart blocks. You cannot create a hyperlink output element within the Database Wizard, but you can replace an ordinary output element with a hyperlink output element after you finish the wizard.
Although it is possible to insert a hyperlink output element in an input block, neither the content it displays nor the value of the parameter it passes to the destination document can come from a database field. However, these items can be supplied by parameters passed to the document containing the input block.
To add a hyperlink output element to a block
- Place the insertion point in an empty cell of the table containing the block. (Insert a new row or column if necessary.)
- On the Develop menu, go to Database, click Field,and then click Output Element with Hyperlink.
- Click the … button next to the Database field box and select the database field that will provide the content displayed by the output element. (If the desired field is not listed, click Cancel and add it to the list of fields used by the block in the Database Fields tab of the Block Properties dialog box.)
- In the Base URL box, enter the URL of the destination document for the links generated by the hyperlink output element. (If the URL will be supplied by a parameter passed to the current document, click the … button next to the Base URL box and select the parameter.)
- Under Parameter, in the Name box, enter the name you want to use for the parameter that will be included in the generated links.
- Click the … button next to the Value box and select the database field that will provide the value of the parameter. (If the desired field is not listed, click Cancel and add it to the list of fields used by the block in the Database Fields tab of the Block Properties dialog box.)
- Click OK.
If the document specified as the destination of the generated links contains a database-driven content block created with the Database Wizard, you need to register the parameter in that document before you can use it in that document’s filter condition. (See “Registering a parameter“.)
Related topics
Adding an (ordinary) output element
Using parameters with database-driven documents
Filtering and sorting database records