Sitefinity

Pages API Overview Send comments on this topic.
See Also
Developing with Sitefinity > Pages > Pages API Walkthrough > Pages API Overview

Glossary Item Box

While Sitefinity provides full fledged user interface for working with pages (and all of their defining parts), one can take advantage of Pages API to accomplish any of the Pages-related tasks programmatically. This topic will demonstrate how to work with pages, themes, controls and properties dynamically by taking advantage of Sitefinity Pages API.

 

Every Web site consists of numerous pages, and Web sites built with Sitefinity are no exception to this rule. The important thing to note about Pages in Sitefinity is that they do not have underlying files that represent them - for example, if you have "About us" page, you will not be able to find about_us.aspx file. Every page in Sitefinity is defined by the following factors:

  • Template – defines the layout of a page
  • Theme – defines the look-and-feel of a page
  • Controls – define the content and functionality of a page
  • Properties – define various attributes of the page, such as URL, menu title, and so on
To learn more about the general concept of Sitefinity pages, please take a look at the Pages Overview topic. 

 

There are several types of data that one will use when working with Sitefinity Pages API. The data used by Sitefinity Pages API can be generally divided into the following groups:

 

Also, when working with Pages API, you will occasionally work with some higher-level interfaces. Those are:

 

Let’s take a look at the following diagram (Figure 1) to see the roles and relationships between the data available in Pages API.
 

Pages API Walkthrough

Figure 1


From the diagram we can see that IPageBase is the base interface for pages and templates. Right under IPageBase we have IPageContent, which implements IPageBase. The IPageBase interface defines the rudimentary members of any page or template. The IPageContent interface is a bit more detailed and defines the members used by a page or template. IPageContent can be used to create a public version of a page, while more detailed implementations such as IPage / IPageTemplate / ICmsPage and IStagedPage are generally used for working with the specific functionalities of each data type.

You might notice that both pages (ICmsPage) and templates (IPageTemplate) implement the IPage interface, which means that working with pages and templates in Sitefinity has many things in common. Both IPageTemplate and ICmsPage represent the properties of a particular page or a template. For each IPage object we can get the staged version, which is of type IStagedPage. IStagedPage represents a page or a template, similarily to IPageTemplate or ICmsPage interface, but from a different perspective. While IPageTemplate or ICmsPage represent the properties of a page or a template (as part of a Web site), IStagedPage represents the controls and structure of the page itself.

Each page or template consists of controls which are of IWebControlBase type. In turn, every control is defined through its properties, which are of type ICmsControlProperty. Based on the persisted properties, proper instance of the control will be instantiated when needed.

 

API Class

The full name of API class for Sitefinity Pages API is Telerik.Cms.CmsManager. This is the class you should use when working programmatically with Pages, Templates and Controls in Sitefinity.

How to start using CmsManager class

There is only one way to create a new CmsManager class. You should use empty constructor which will create a new instance of CmsManager with the default provider.

Create a new instance of CmsManager with default provider:

Copy Code
// Creates a new instance of CmsManager with empty constructor. Default
// provider will be used.
Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();

 

Pages API Documentation Structure

 

Pages:

Templates:

Controls:

See Also