tags:

views:

41

answers:

2

I am creating a widget in Ektron CMS400 and I am trying 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!

A: 

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.

chelfers
Spongeboy
+1  A: 

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;
}
maddoxej