Page Information Example
Displaying information about the current page, or even any page where you know the page ID is as simple as accessing a .NET object and retrieving the property you need. In the CMS all pages are represented by the ContentPage class, which contains properties such as the title, author, created date, roles etc.
In this example we will render out some properties for the current page. The current page can be found in the static class cmsx.Manager.Current.
The ASCX File
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PageInfo.ascx.cs" Inherits="PageInfo" %>
<h2>Page Information</h2>
<table>
<tr>
<td>Page title:</td>
<td><%= cmsx.Manager.Current.Title %></td>
</tr>
<tr>
<td>Author:</td>
<td><%= cmsx.Manager.Current.Author %></td>
</tr>
<tr>
<td>Created:</td>
<td><%= cmsx.Manager.Current.Created.ToString() %></td>
</tr>
<tr>
<td>Version:</td>
<td><%= cmsx.Manager.Current.Version %></td>
</tr>
</table>
The ASCX.cs File
There is no code in the c# file. We are simply rendering out the properties of the current page.
The Web.config File
<add tagPrefix="testing" tagName="PageInfo" src="~/modules/PageInfo/PageInfo.ascx"/>
This module renders out the Title, Author, Created and Version properties of the current page. The ContentPage object contains many more properties which can be used in your CMS module.