Documentation

Content

Get Method

Syntax:

public IPage Get(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the page to retrieve

Return value:

Type Description
IPage The content object representing the page
 

Examples:

@this.Api.Content.Get(1234).Title.Get(this.Model.Context.Culture, this.Model.Context)


Get Method

Syntax:

public T Get<T>(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the page to retrieve

Return value:

Type Description
T The object represented by the type T
 

Examples:

@Api.Content.Get<Document>(1234).CurrentFile.FileName


GetAll Method

Syntax:

public IList<IPage> GetAll(params int[] contentIds)

Parameters:

Parameter Type Description
contentIds params int[] The array or comma separated list of content IDs to retrieve

Return value:

Type Description
IList<IPage> The list of content pages
 

Examples:

<ul>
@foreach (var page in Api.Content.GetAll(1234, 1235, 1236))
{
    <li><a href="@page.Url">@page.Title.Get(this.Model.Context.Culture, this.Model.Context)</a></li>
}
</ul>

//or

<ul> // where contentIds is a List<int> or int[] @foreach (var page in Api.Content.GetAll(contentIds)) { <li><a href="@page.Url">@page.Title.Get(this.Model.Context.Culture, this.Model.Context)</a></li> } </ul>


 

GetChildren Method

Syntax:

public IList<IPage> GetChildren(int contentId)

Parameters:

Parameter Type Description
contentId int The content id of the parent page whose children you want to retrieve

Return value:

Type Description
IList<IPage> The list of content pages
 

Examples:

<ul>
@foreach (var page in Api.Content.GetChildren(1234))
{
     <li><a href="@page.Url">@page.Title.Get(this.Model.Context.Culture, this.Model.Context)</a></li>
}
</ul>