Ektron pageID in C#
I am creating a widget in Ektron CMS400 and I am tr开发者_Python百科ying to dynamically pull the page layout ID to then display the title. Currently I have this code:
PageTitle = contentAPI.GetContent(110, Ektron.Cms.Content.EkContent.ContentResultType.Published).Title
I would like to replace the 110 with an actual reference to the ID of the current page ( not content block ) being displayed. Muchas gracias!
You can save a database call by not getting the content again. The page layout has already been loaded.
/// <summary>
/// Gets the page Basedata.
/// </summary>
/// <returns>The content or null if not on a PageBuilder layout</returns>
private ContentBase GetPageBasedata()
{
PageBuilder myPage = this.Page as PageBuilder;
if (myPage != null)
{
return myPage.Basedata;
}
return null;
}
Wow, I feel silly. Even though the pageid does not show up in the URL I can still reference it via Request["pageid"]. Oh, bother.
This function will return the page ID of an Ektron Page.
public long GetPageID()
{
long pageid = new long();
Ektron.Cms.PageBuilder.PageBuilder myPage = this.Page as Ektron.Cms.PageBuilder.PageBuilder;
if (myPage != null)
{
pageid = myPage.Pagedata.pageID;
}
}
精彩评论