Developer forum

Forum » Templates » what is the easiest way to find out what language area (areaid) a page belongs to?

what is the easiest way to find out what language area (areaid) a page belongs to?

Hans Ravnsfjall
Hans Ravnsfjall
Reply

In an item publisher that is.

what is the easiest way for me to find out what areaid a page belongs to when in a loop of an item publisher?

I presume i have to use the API. Anyone got a code snippet lying around for this, that they are willing to share?

 

/Hans


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Something like this:

foreach (LoopItem item in GetLoop("ItemPublisher:Items.List"))
 {
 var page = Dynamicweb.Content.Services.Pages.GetPage(item.GetInteger("ItemPublisher:Item.Field.PageId"));
 var areaId = page.Area.ID;
 }
Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Nicolai, you´re the man 👍

 

thank you

 

You must be logged in to post in the forum