
Database Query
Components User's Guide
71
2
Create the Database Query component, and include a
layout
property which
specifies the path to the layout file to use for details pages. Make sure that the query
returns
all
of the fields which you want to display, either from the component itself, or
on the details page.
3
Determine which fields you want to link to details pages, and add
<a href>
tags
which use the
$node.detailsurl
macro to automatically generate the links.
Review the detailed instructions in the following sections.
How to Set Up a Layout File
In order to generate and link to details pages, you must set up a layout file. The layout file
is a template for all details pages in a particular Database Query component; all content
on the layout file will appear on all details pages, including content that is generated by
other Collage components.
The layout file uses layout field components to display additional fields from the linked
row. Each field component is a placeholder for a particular field from the linked row. When
Collage generates the details page, it displays the actual value of the field, for the linked
row.
To set up a layout file for Database Query details pages:
1
Create a new HTML file or, if you already have a template for details pages, open it.
2
Add the following layout field component code wherever you want to display a field
value:
<nexus:field column="
column name
"/>
Where
column name
is the name of column for which you want to display the value.
For example, if you want to display the value of the
Name
column for the linked row,
define the component as:
<nexus:field column="Name"/>
3
Check in the layout file in Collage.
How to Generate Links to Details Pages
In order to link to a layout file, the Database Query component must include a
layout
property which specifies the full path in Collage to the file. Then, for each field you want to
link, add
<a href>
tags that use the
$node.detailsurl
macro to automatically
generate the link.
To generate links to details pages:
1
When you create the Database Query opening tag, be sure to include the
layout
property. For example:
layout="/System/WebSite/emp_details.htm"
See "Writing the Database Query Opening Tag" on page 65 for details on writing the
opening tag.
2
In the body of the Database Query tag, add the following tag to each field that you
want to link to a details page:
<a href="$node.detailsurl">$node.column("
column name
")</a>
Commenti su questo manuale