Developer forum

Forum » CMS - Standard features » Is it possible to get data from item based page published to a sitemap structure?

Is it possible to get data from item based page published to a sitemap structure?

Hans Ravnsfjall
Hans Ravnsfjall
Reply

What I am looking for, is a combination of the sitemap module, and item publisher.

I want to get a sitemap structure of a listing of itembased pages. For that I could use the sitemap module. But I also want to publish a value that is on the item based page, but not part of the normal sitemap.xml. In this specific case, all the itembased pages have a color field, with a color decleration. In my sitemap, I also want to publish the color attribute for each of the pages. Tat would be no problem doing using the Itempublisher, but then I cant get the multilevel navigation structure (parent/child etc.), or can I?

Is it possible to use the Itempublisher to get a sitemap page relation list rendered? Or will all the items just render in a loop without any form of structure?

 

Or can my wish be achieved in another way?

 

BR
Hans


Replies

 
Nicolai Pedersen
Reply

Hi Hans

Using the item publisher it is possible to get hold of the page, and hence the parentid of the page, and that basically gives you the tree. In the sitemap all it does is structuring some data based on that parentid along with the sort value.

It is also possible in the sitemap module to use a Razor template, and then lookup the pageinstance using the API and finding the color field from the page. Using Dynamicweb.Extensibility.ServiceLocator.Current..GetInstance(Of Dynamicweb.Content.IPageService)().GetPage(ID).Item.Value["ColorFieldname"]

BR Nicolai

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Perfect, thank you Nicolai

I will try that.

I am new to these services/extenders (not sure what it is called), but will definetily be looking more in to it, as it seems pretty powerful for accomplishing a little more requiring tasks. Is there some documentation on this? I trie searching the API documentation for eg. Dynamicweb.Extensibility.ServiceLocator.Current..GetInstance

But couldnĀ“t find anything.

Br.

Hans

 
Nicolai Pedersen
Reply

Hi Hans

The service locator is a generic extensibility feature used in DW9.

Find it here: http://doc.dynamicweb.com/api/html/6f9b65dd-0de3-dd16-4782-7c3639b9476e.htm

In this case, the pageservice is the interesting one: http://doc.dynamicweb.com/api/html/15516fc9-3e1c-ac41-9849-cc6ad67bb84d.htm

In dw8, look for Dynamicweb.Content.Page.GetPageBy*

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Ok, thank you Nicolai :)

I will do that.

BR

Hans

 

You must be logged in to post in the forum