Adobe
GoLive 6 Dynamic Content Samples
Overview
Database Design
Monthly View

A. Filler Cell. B. Month Popup with new value action. C. Cell with content from XML element.

Content Sources

The page has a single XML content source, CalendarBoxes, connected to the Calendar XML data source. The structure of the XML data source contains a nested rowset which implicitly causes a second content source to be defined. CalendarBoxes delivers the top level elements of the XML source which represent the months. CalendarBoxes/Boxes, the nested content source, delivers the individual box elements present in each month.

Custom Script Function BoxClass

Also present in the head section is a script that is used to choose the CSS style for a box. It returns "ColumnItem" if the box is a filler cell at the beginning or end of the month, and "ColumnItemAlt" if the box is a numbered day.

The function is called using custom code that looks like this:

<td class='<?php echo BoxClass($CalendarBoxes->Value("Box/@Day"))?>' height="85"> ... </td>

The BoxClass function is passed the value of the Day attribute for the current box. The code for this is simply copied from somewhere else on the page where the page element is bound to Day.

A. Filler Cell

Cells at the beginning and end of the month do not have a non empty value for the Day attribute. The BoxClass function is used to set the CSS style for the box.

B. Month Popup

The month popup has an attribute to reload the page when the value is changed. This attribute contains Javascript and looks like:

onchange="document.URL = 'month.php?Month=' + popup.value"

The page itself also has an onload attribute on the <body> tag that sets the popup from a URL parameter:

onload='popup.value="<?php echo pageParameter("Month", "January")?>"'

The pageParameter function is supplied by GoLive and returns the URL parameter Month if it is present and an alternate value, in this case "January", if it is not present. The onload attribute is executed by the browser when the page is loaded and sets the popup to the proper value.

C. Content Cell

The cells (both filler and content) are generated by a repeat cells table. To setup this table, select Repeat Cells, pick the content source. Seven cells per row generates the calendar boxes.

Containers

The XML file contains calendar data for 12 months. To generate the calendar page for a specific month, you need to filter out the other 11 months and show the one that matches the URL parameter: "month.php?Month=April" (for example). The top level of the XML contains 12 elements, one for each month. The calendar table itself is contained first in a conditional container with condition shown below. In the field name "CalendarBoxes/@Month" the "@" indicates that the Month field is an XML attribute.

This container is contained within a second container that repeates for each record in the CalendarBoxes XML content source. The result is that each month is examined, and the calendar page is generated only for the month whose name matches the URL parameter Month.