A common task is to show a list of content that is related to the content currently being viewed.
To perform this task, begin by creating a web page on your site that displays Krames StayWell content in one part of the page and links to related Krames StayWell content in another part.
The page calls the GetContent Web Service method with the Content Type Id and Content Id of the content to be displayed. The result of the method call is an XML document that contains the all relevant data concerning the content.
The web page should transform the response XML into HTML for displaying the content. The transform used must be able to handle <img> and <media> elements within the XML, as well as other StayWell custom elements, as follows:
- <img> elements must be transformed to add a src attribute based on the imageid, at a minimum. This is usually in the form of a dynamic page on your site. Other attributes may be present in the <img> element that may also need to be transformed into HTML, such as expanded image information and captions. See the sample XML transform for one way to do this.
- Media elements must be transformed according to the value of the mime type attribute. The three types currently supported are "video/x-flv", "application/pdf", and "application/x-shockwave-flash". Please refer to the sample transform for examples of how to transform these types. Pay particular attention to the "video/x-flv" section; the object element created by the transform should contain all of the child elements Krames StayWell includes at a minimum.
- Other custom elements are also covered in the sample transformation file. This file is a good starting point for all implementations. It can be expanded to add class names for client specific CSS styling as needed.
Krames StayWell content does not include any style information, such as font family, size, colors, etc. It is expected that the each implementation should apply their site's CSS styles to the elements contained in the StayWell content, as appropriate.
After transforming, your page renders the Krames StayWell content within the section of the page you intend to display it in. Additional metadata, such as the author of the content, the last reviewed date, etc., can also be transformed and displayed on the same web page as the Krames StayWell content if desired.
Your page then calls the GetRelatedContent method, passing in the same ContentTypeId and ContentId that was used to retrieve the main document. The result of this call is an XML document containing Content elements for each related item, if any.
Your page transforms the response XML into a list of links and renders this in the section of the page where you intend to display them.