Looping Through Children Elements

63 views
Skip to first unread message

Heather Napoleone

unread,
Feb 6, 2017, 3:15:51 PM2/6/17
to RedDot CMS Users

I have a page with a list element and would like to display each item in that list and also display its children as subbullets in that list (see below).

 

Main Page

-List item A

---Child list item 1

---Child list item 2

--List item B

---Child list item 1

---Child list item 2

 

Currently we can only access the total number of child list items using this rendertag:

<%!! Context:Pages.GetPage(Guid[GUID OF LIST).Elements.GetElement([CHILD LIST]).Value.Count !!%>

 

What we can’t do is loop through each child list item and pull elements from it to display on the main page.

Hilmar Bunjes

unread,
Feb 7, 2017, 10:18:47 AM2/7/17
to RedDot CMS Users
Heather,
you can iterate through multilinks list list and containers like this:

<ul>
<reddot:cms> 
<foreach itemname="myItem" object="Context:CurrentPage.Elements.GetElement(lst_pages).Value" countername="counterVar">
<htmltext>
<li>
<%!! Store:myItem.Id !!%>, <%!! Store:myItem.GetUrl() !!%>, <%!! Store:myItem.Headline !!%>
</li>
</htmltext>
</foreach> 
</reddot:cms>
</ul>

HTH,
Hilmar
Reply all
Reply to author
Forward
0 new messages