Hey,
I am trying to pull data from the top-most Parent. Right now I can access data from the Parent of the current page, but if I am deeper nested it won't access the page I need, and if I am on the page I need, it won't access the data. D:
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hey,
I am trying to pull data from the top-most Parent. Right now I can access data from the Parent of the current page, but if I am deeper nested it won't access the page I need, and if I am on the page I need, it won't access the data. D:
Hmm, I got it 2/3 working. I can access the direct Parent or if there is no Parent, access the current Page, but Level(3)+ Pages still don't show the content I need.
<% if Parent %>
<% control Parent %>
<% control Carousels %>
<li>$Image<span><a href="$URL">$Caption</a></span></li>
<% end_control %>
<% end_control %>
<% else %>
<% control Carousels %>
<li>$Image<span><a href="$URL">$Caption</a></span></li>
<% end_control %>
<% end_if %>
^-- DISREGARD THAT --^
This just dawned on me as I was making the previous post, and it works:
<% control Level(1) %>
<% control Carousels %>
<li>$Image<span><a href="$URL">$Caption</a></span></li>
<% end_control %>
<% end_control %>
Thank you for following this through in the forum. You just helped me through a bit of a trouble spot!
Not a problem! I only wish more people would do so, that way everyone would have their answers. :)