Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Pull data from top-most Parent


Go to End


5 Posts   3693 Views

Avatar
Karai

Community Member, 13 Posts

23 May 2009 at 1:59pm

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:

Avatar
Karai

Community Member, 13 Posts

23 May 2009 at 3:40pm

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 %>

Avatar
Karai

Community Member, 13 Posts

23 May 2009 at 3:42pm

^-- 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 %>

Avatar
AlaVive

Community Member, 42 Posts

19 September 2009 at 8:20am

Thank you for following this through in the forum. You just helped me through a bit of a trouble spot!

Avatar
Karai

Community Member, 13 Posts

19 September 2009 at 8:55am

Not a problem! I only wish more people would do so, that way everyone would have their answers. :)