Hi
I have createt my first Item list as a page. What i mean is an item that contains other item elements. But how do I publish these on a page? Is it some kind of loop on the page, or do I just attach a template to the item elements?
regards, Hans
Hi
I have createt my first Item list as a page. What i mean is an item that contains other item elements. But how do I publish these on a page? Is it some kind of loop on the page, or do I just attach a template to the item elements?
regards, Hans
Hi Hans
In you Item list template, you have a loop of items, and inside that, a loop of fields. If the field is of type list of something, i.e. the list of items you mention, that also have a loop. The name of the loop depends on your field system name.
You can find the loop using this instance of dwtemplatetags - that list of tags will give you a loop of the items in the list of that field.
<!--@LoopStart(ItemPublisher:Items.List)--> <!--@LoopStart(ItemPublisher:Item.Fields)--> <!--@DwTemplateTags--> <!--@LoopEnd(ItemPublisher:Item.Fields)--> <!--@LoopEnd(ItemPublisher:Items.List)-->
BR Nicolai
Hi
I can´t get this to work. The itemlist is created as a page. From what I see in your suggestion Nicolai, you are referring to where the ItemPublisher is used?
I was looking for at solution where, the an itemtype of the sort ItemsList is created as page, and it contains other items inside this item list. It´s a bit hard to explain, but A link to the page is here. http://kf.net.dynamicweb-cms.com/Default.aspx?ID=443
Ofcourse, I can´t publish anything - but the templateTags is enabled.
Hi Hans
In your item, you have created a field called "Element" which is the list of your elements.
That field has a loop, since it is a list of items, and is is called <!--@ LoopStart(Item.Element)--> <!--@ LoopEnd(Item.Element)--> which you can also see from the template output.
So simply loop them like this:
<!--@LoopStart(Item.Element)--> <!--@DwTemplateTags--> <!--@LoopEnd(Item.Element)-->
Ok, this works Perfectly Nicolai :)
Is it possible to extend the loop with a Sort or an OrderBy attribute, so that you can publish items in diffent sortings? If not, what alternative solution do you suggest for this?
regards Hans
Hi Hans
In HTML you cannot sort the items differently, but using Razor you can - see this post:
http://developer.dynamicweb.com/forum/templates/razor-groups-orderby-with-linq.aspx
BR Nicolai
You must be logged in to post in the forum