Happy Thanksgiving! I shouldn't be working but this issue is driving me nuts and I'd love to figure this out.
I have a use java class that has a method called getPage. The code is below. The idea is to get all the child page underneath the page where this component lives.
public List<Page> getPage() { List<Page> results = new ArrayList<Page>(); Iterator<Page> children = getCurrentPage().listChildren(); while (children.hasNext()) { Page child = children.next(); results.add(child); } return results; }
I call it in my component like so
<div class="directory"> <div class="row" data-sly-list.childPage="${comp.page}"> <div class="small-6 medium-3 large-3 columns"> <a href="${childPage.path}"> <img src="#nestedProperty"> <h4>${childPage.title}</h4> </a> </div> </div> </div>
tile and path work great, but I'd like to call a nested property. Here's the nested property (slide1FileReference) I'm talking about.
I found some documenation online and tried this but it doesn't work
<img src="${childPage.properties[root/c1_leadspace_carouse/slide1FileReference]}">
Solved! Go to Solution.
Missing quotes -__-
<img src="${childPage.properties['root/c1_leadspace_carouse/slide1FileReference']}">
Views
Replies
Total Likes
Missing quotes -__-
<img src="${childPage.properties['root/c1_leadspace_carouse/slide1FileReference']}">
Views
Replies
Total Likes
The way you access the properties is correct.
Can you share a package or so?
I was missing the single quotes! All good now thanks for commenting on the holiday!
Views
Replies
Total Likes
Indeed the quotes :-)
BTW: No Java is needed here.
<div class="directory">
<div class="row" data-sly-list.childPage="${currentPage.listChildren}">
<div class="small-6 medium-3 large-3 columns">
<a href="${childPage.path}">
<h4>${childPage.title}</h4>
<h4>${childPage.properties['cq:template']}</h4>
</a>
</div>
</div>
</div>
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies