Using the ContentList Server Control

The ContentList server control displays a list of content blocks on a Web page. In contrast to a List Summary, where content must be in a specified folder, the ContentList server control displays content from any Ektron folder. Depending on the setting you choose for DisplayXslt, you can change information displayed for each content block.

When added to a template and visited, a ContentList Summary looks similar to the following.

ContentList server control options
  • Define a content list in a content block's metadata. Then, assign that content block’s ID in the DefaultContentID property. See Also: Using Metadata to Display an Associated Content List

    When using this option, an administrator typically sets up the Workarea portion of the process. Then, a developer adds the server control to a Web form and assigns the content block ID and the metadata name to the appropriate properties. Because the content list is assigned to a content’s metadata, you can pass the content ID dynamically in a Web form and display a list for each content block you defined.

  • Assign a comma-delimited list of content blocks to the ContentIds property. See Also: Using the ContentID Property to Display a Content List

    Using the ContentIds process, a developer adds the ContentList server control to Web form. Then, the developer defines a list of content IDs in the ContentIds property. If the server control or the list in the ContentIds property is deleted, it is not available and will have to be created again.

ContentList server control properties

The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.

  • Authenticated (String)

    Indicates if you are logged into the CMS Explorer and can use it to browse to content, collections, and so on. See Also: Browsing Your Ektron Site Using CMS Explorer.

  • CacheInterval (Double)

    The number of seconds that the server control’s data is cached. The default is 0 (zero). For example, if you want to cache the data for 5 minutes, set to 300. See Also: Caching with Server Controls.

  • ContentIds (String)

    A comma delimited list of content block IDs. See Also: Using the ContentID Property to Display a Content List

  • DefaultContentID (Long)

    Set content ID value. When set, content IDs are generated from the MetaTag value for this content.

  • DisplayXslt (String)

    Determines how information on the page appears.

    • None—databind only
    • ecmNavigation—lists the title of each content block See Also: ecmNavigation Display Example
    • ecmTeaser—lists the title of each content block plus the content summary. See Also: ecmTeaser Display Example
    • ecmUnOrderedList—sorts the list in no particular order. Shows the title and content summary
    • Path to Custom Xslt—If desired, enter a relative or absolute path to an Xslt that determines the display of the page.

    WARNING! If you specify an external file, do not store this file in the Workarea folder. If you store this file in the Workarea folder, the file will be lost when you upgrade.
    If you enter a valid EkML file at the MarkupLanguage property, the Displayxslt property value is ignored.

  • DoInitFill (Boolean)

    By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.

  • DynamicParameter (String)

    Uses the QueryString parameter to read a content ID dynamically.

    • None - Use Default—use the default content ID list.
    • ID—reads a content block’s ID dynamically.
    • ekfrm—reads a form block’s ID dynamically.
  • GetAnalyticsData (Boolean)

    Set this property to True if you want the following information for each content in the list. Returns Content View Count, Content Rating, Content Rating Average. Create your own XSLT styles to display this data.

    WARNING! This property only provides reliable data when the Business Analytics Feature is on. Business Analytics.

  • GetHtml (Boolean)

    Set to True if you want to retrieve and display content (html body) for all content blocks in the list summary. For example, to display content inside a Web server control such as a GridView.

    • True—Get and display HTML for each content block in the list summary
    • False—Do not get and display HTML.
  • Hide (Boolean)

    Hides or displays the output of the control in design time and run time.

    • True—Hide the control output.
    • False—Display the control output.
  • IncludeIcons (Boolean)

    Choose whether to display icons next to the content list’s links.

    WARNING! This property only works when ecmSummary or ecmTeaser are used in the DisplayXslt property. When the [$ImageIcon] variable is used in an EkML file and that file is assigned to the MarkupLanguage property, this property acts as True.

  • Language (Integer)

    Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).

  • LinkTarget (ItemLinkTargets)

    Determines the type of window that appears when you click a link in the server control.

    • _Self (default)—opens in same window.
    • _Top—opens in parent window.
    • _Blank—opens in new window.
    • _Parent—opens in the parent frame.
  • MarkupLanguage (String)

    Identify the template markup file that controls the display of the server control. For example, mymarkup.ekml. If the EkML file is located in the same folder as the Web form containing the server control, just enter its name. Otherwise, the path to the file can be relative or absolute. See also: Controlling Output with Ektron Markup Language

    See Also: contentlist.ekml

    NOTE: If you enter a valid EkML file at the MarkupLanguage property, the Displayxslt property value is ignored. If the EkML file contains the [$ImageIcon] variable, the IncludeIcons property acts as True.

  • MetaTag (String)

    Specify a Metadata definition whose type is Content Selector. When you do, the associated list of content items will appear where you place the server control.

    WARNING! You cannot insert other metadata types.

    This works with the DefaultContentID property. For more information about using metadata to assign a list of related content to a content item, see Creating and Deploying a Related Content Definition.

  • OrderByDirection (Ektron.Cms.Controls.CmsWebService.ContentListOrderByDirection)

    Determines which direction to sort content determined by the OrderBy property.

    • ascending—items are arranged A, B, C or 1,2,3.
    • descending—items are arranged. Z,Y,X or 3,2,1.

    If sorting by date, descending puts the most recent first. When ascending is selected and the OrderBy property is set to OrderOfTheIds, the order of the IDs are preserved. When set to descending, the order is reversed.

  • OrderBy (Ektron.Cms.Controls.CmsWebService.ContentListOrderBy)

    Sort the list by one of these values:

    • Title—the order of the content’s title.
    • DateModified—the last date the content was modified.
    • DateCreated—the date the content was created.
    • LastEditorFname—the last editor’s first name.
    • LastEditorLname—the last editor’s last name.
    • OrderOfTheIds—preserves the content ID order based on the list in the ContentIds property.
    • ContentRatingAverage—Business Analytics Content Rating
    • ContentViewCount—Business Analytics Content Views
  • Random (Boolean)

    Set to True if you want to randomly display one content block link from the content list. The content changes each time a user views the page.

    • True—randomly display one content block in the specified folder.
    • False—display the content list normally.

    NOTE: If you use a custom XSLT or EkML file, the type of content displayed can be manipulated. For example, if you use an EkML file that has the [$Html] variable in it, the actual content appears instead of a link. See Also: Controlling Output with Ektron Markup Language and [$Html]

  • SuppressWrapperTags (Boolean)

    This property is set to false because Ajax uses <div> tags to rewrite the region around the tag. You cannot change the value to true.

  • WrapTag (String)

    Lets a developer specify a server control’s tag.

    • Span (default)—designate an inline portion of an HTML document as a span element.
    • Div—apply attributes to a block of code.
    • Custom—Lets you use a custom tag.
Using metadata to display an associated content list

Using Metadata to Display an Associated Content List

You can use the ContentList server control to display a list of content associated with a given content item. First, you define a content list in the metadata of a content block. Then, assign the ID of the content block to the ContentID property and specify a Metadata definition in the MetaTag property. The ContentList server control pulls information defined in the metadata of the content to display the list of content.

The following steps show how to use the DefaultContentID and MetaTag properties to create a content list.

  1. In the Ektron Workarea, choose Settings > Configuration > Metadata Definition.
  2. Click Add Metadata Definition.
  3. Enter a title for the data in the Name field. This name is used in the MetaTag property for the server control.
  4. Fill in all standard fields. The Type must be Content Selector.
     

  5. Click Save.
  6. Add the definition to all appropriate folders.
    1. Right click a folder and choose View Properties.
    2. Click Edit Properties.
    3. Click on the Metadata tab and check the boxes next to the metadata definition. (You may have to break the inheritance.)
    4. Click Update.
  7. For each content item to which you want to associate related content, access its Metadata tab and identify the related item(s). For example, a list of content blocks associated with motorcycle helmets. You want this list to appear whenever a helmet is being viewed. To set this up, you would
    1. Edit the content block
    2. Click its Metadata tab
    3. Find the metadata definition for the Content List
    4. Click Edit
       

    5. Select the content blocks to be in the list and click Insert to display them in the list below.
       

  8. Optionally reorder the list, then click Save.
  9. On a Web form in Visual Studio, add the ContentList server control.
  10. Set the DefaultContentID property to the content block’s ID.
  11. Add the name of the Metadata field in the Workarea to the MetaTag property.
     

  12. Set all other properties using the table at the beginning of this section.
  13. When the Web form is saved, navigate to the page. The content list appears.
     

Using the ContentID property to display a content list

Using the ContentID Property to Display a Content List

  1. On a Web form in Visual Studio, insert the ContentList server control.
  2. Add a comma delimited list of content IDs to the ContentIds property.
     

  3. Set all other properties using the table at the beginning of this section.
  4. When the Web form is saved, navigate to the page. The content list appears.
     

Retrieving the XML structure of a ContentList

Retrieving the XML Structure of a ContentList

Retrieving the XML structure of XML content allows for greater control over developing XSLs. The following is an example of how to retrieve the XML structure:

  1. Open a new Web form.
  2. Drag and drop a ContentList server control onto it.
  3. Add at least one content ID to the ContentID property.
  4. Drag and drop a textbox on the Web form.
  5. Set the TextMode property to MultiLine.

    NOTE: You should set the text box width to at least 400 px.

  6. On the code-behind page, add the following line.

    Textbox1.Text = ContentList1.XmlDoc.InnerXml

  7. Build the project.
  8. View the Web form in a browser. The XML structure of the ContentList appears in the textbox.

For an additional example, see the ContentList XML page on the CMS400Developer samples page. It is located at:

In a browser:

http://siteroot/CMS400Developer/Developer/ContentList/ContentListXML.aspx

In the source code:

siteroot/CMS400Developer/Developer/ContentList/ContentListXML.aspx and ContentListXML.aspx.vb