Sitefinity CMS

Generic Content Public Controls Send comments on this topic.
See Also
Sitefinity Building Parts > Modules > Generic Content > Generic Content Public Controls

Glossary Item Box

This topic provides a description of the public controls of the Generic Content module:

 Generic Content: Public Controls

 Figure 1 

Generic Content

This subsection presents the characteristic features and usage scenarios of the Generic Content public control.

 

The Generic Content public control displays content on a page (see Figure 2). It is based on the RadEditor control (one of Telerik's RadControls).

Generic Content Public Controls: Generic Content Control

Figure 2

 

Figure 2 illustrates that there are two links below the content editor. One of the links, Share this content, is for sharing the current content item so that other pages could display it as well. When this link is clicked, a window pops up and includes three text fields: Name, Description, and Author (see Figure 3). The data entered in them will be provided when this content is accessed for sharing by other pages. 

Generic Content Public Controls: Generic Content Control - Share Content

Figure 3

 

The second link, Select shared content, is for adding an existing content item. When this link is clicked, a window pops up and provides the option to choose which module the content should belong to. After selecting the module from the drop-down menu, choose the content item and press Select (see Figure 4).

Generic Content: Public Controls: Generic Content Control - Select Shared Content

Figure 4

 

Content View

This subsection presents the characteristic features and usage scenarios of the Content View public control.

 

What is Content View?

The Content View control lists content items.

Currently, there are two Sitefinity controls that only partially provide such functionality: the built-in modules Generic Content and Lists. The Generic Content module displays a single content item but it allows for various customizations (see Overview of Generic Content Based Modules). At the same time,  the Lists module lists several content items. However, it is not expandable and thus provides no possibility for usability improvements. The Content View control combines the most useful features of both modules. This makes it extendable, easy-to-use. It is built to work out-of-the-box and with some slight modifications to serve your purpose in many possible cases.

   

Setting up Content View Properties

The Content View control displays all items added to the Generic Content module in the form of a list. Modify its properties to achieve different behavior of the control. Following is a description of some of the properties of Content View, ordered by sections:

 

Section Behavior 

Display Mode

This is the most important property of the Content View control. Following are its possible values and their description:

Auto mode
This mode is set by default. When this mode is selected, the control displays a list of content items. Each item could have a link to a mode where the page displays only that item. All this is handled by the control. The following applications could make use of this mode: blogs; news; galleries with thumbnails and full-sized images; job listings; real estate properties for sale.

Item List mode
When this mode is selected, the control displays only a list of content items. This mode does not provide the ability to view the specific item in the page. Here are some examples where this mode would be useful: list of files for download; short news page; page with short advertisements; gallery of full-sized images.

Single Item mode
When this mode is selected, the control displays only one content item on the page. To make it work, you will additionally need to add the tag by setting the SelectedItemId property.

Tags mode
When this mode is selected, the control displays a list of content items tagged by a specific tag. Also, a single item could be viewed separately. To make this mode work, add the tag by setting the TagID property. Here is an example where this mode would be useful: when there is a bigger content base, and only part of it should be displayed. The solution is to tag some of the items with a specific tag and use this mode.

Categories mode
Works exactly like Tags mode, except that the CategoryID property should be set. Categories are applicable for most of the cases for tags. Still, there is an important difference: the usage of categories is similar to that of folders - an item could belong only to category.

AllowLinksToPrevNextItem

This property enables links to the previous and next items from the list when viewing items separately.

ItemListUrl and SingleItemUrl

These properties allow displaying the List and Details views on two different pages. This is how to do it:

  1. Let’s say there is a page called Page1.aspx, and a Content View control is dropped on it. We want to make this page handle the display of the list of content items. We need to set the SingleItemUrl property to point to the URL of the page (Page2.aspx) where another Content View control will handle the display of the full content of only one content item.
  2. Page2.aspx needs to have the Content View control dropped on it and it will display the full content of only one content item. We need to set the ItemListUrl  to point to the page with the list of content items (Page1.aspx) so that the user can navigate back to it if needed.

SortExpression

This property provides the ability to sort the list of content items in a custom manner. It is set by default to “Publication_Date DESC” which sorts content items by their publication date in descending order (from old publication dates to new ones).

SummarySettings

This property provides the functionality to set the format of display of a content item summary. There are two options to make the settings: to provide several variables that define the summary, or to provide a meta field.

  • Summary Variables
    For this option, the property includes four variables: type of unit (words/sentences/paragraphs); unit number (an integer); boolean of whether the html tags should be cleared (false if clearing should not occur); exceptions for the previous variable ("{x}" where x is the tag that should be excluded from the previous setting). For example, let's assume the following is saved in the SummarySettings property: "Words; 20; False; {img}". This means that there should be 20 Words (Words; 20), that html tags should not be cleared (False) except for the image ones ({img}). 
  • Meta Fields
    If this summary option is chosen, only a meta field should be provided for this property. It should be placed in square brackets. For example, the following could be the input in this property field: [Summary] .

ParentIDs

There are cases in which the content resides in an abstract container, such as blog posts in blogs, images in galleries, and so on. This property allows for setting delimited IDs of these containers so that the control displays content items only from them.

DateFrom

Currently Not Implemented! This property will provide the ability to add a starting date which will filter out all older content items.

AllowComments

This property provides the ability to control whether comments can be added to content items. This is a functionality that is applicable for blog comments, comments about a picture in a gallery, and many other cases.

AllowCommentsModeration

This property provides the ability to add comments moderation to a content item. Keep in mind that only the public is provided - the administrative UI needs to be created.

Various *Key properties (TagItemKey, ContentProviderKey, CategoryKey , ContentItemKey, PageKey)

These properties are used as QueryString key names. All of them have default values. When using custom controls that derive from Content View, these properties should have values different from the default ones (those of the Content View control) so that the custom controls and Content View control can work on the same page. Also, when two instances of one and the same control deriving from Content View are added to a page, these properties should be set from the Control Designer for the very same reason.

 

Section Data

ProviderName

When a custom control derives from Content View, the default value should be kept so that the control will be used without the need to set this property later. In order to set the custom control to work with a provider different from the default one, this property should be set to the provider’s name.

  

Section Page Title

PageTitleMode

There are three modes for setting the page title: Append, DoNotSet, Replace.

  • Append
    When this mode is selected, the title of the current item will be appended to the page title.
  • DoNotSet
    When this mode is selected, there will be no change to the page title.
  • Replace
    When this mode is selected,  the page title will be replaced by the title of the current item.

PageTitleMetaFields

This property lists the meta fields which will be included in the page title. For example, they could be the following: Title, Theme, Author .

PageTitleFormatString

This property sets the string format of the page title by defining which meta fields will be included in the title, and in what order. The meta fields are the ones set in the PageTitleMetaFields property. The order depends on the one in which the meta fields have been inputted. The format is the following: "> {x}"  where {x} is replaced by the meta field placed on position x. For example, let's assume that the following meta fields are saved in the  PageTitleMetaFields property: Title, Theme, Author. If " > {0},{2}"  is saved in the PageTitleFormatString property, the meta fields will be the following: Title, Author .

 

Section Paging

AllowPaging

This property provides the ability to allow users to page through the items. By default, it is set to true.

ItemsPerPage

This property provides the ability to set how the number of content items should be displayed on a page when paging is allowed. By default, it is set to 10

 

See Also

Sitefinity Building Parts: Modules
Generic Content Overview
Modules Overview

Developing with Sitefinity: Controls
Example: Extending Content View Control

Developing with Sitefinity: Modules API : Generic Content
Overview of Generic Content API

How-to: Modules
Wrap Generic Content Control in a User Control
Add Custom Meta Fields