Developer forum

Forum » Templates » Razor paragraph item loop

Razor paragraph item loop

Michael Nielsen
Reply

Hi all

I don't know if this is a stupid question of if it is even possible.

I have searched the forums, looked at the documentation and looked at the examplefiles on GitHub, but can't seem to find anything about it.

What I want to do is to loop through paragraph items of a certain type that has been created on the frontpage, but without using the ItemPublisher module.

I.e something like this

var listOfItems = ["How to get the list of items of a specific type from the current page?"]

foreach(var item in listOfItems){
  @item.Link
  @item.Image
}

Is this possible? And if so, how.


Replies

 
Michael Nielsen
Reply

Well it was a stupid question (kinda) :-)

It was just a matter of creating a dwcontent, where the paragraph items would be places, and then in the paragraph template, outputting it with @GetString("Item.Image")

 

You must be logged in to post in the forum