Jump to:

3429 Posts in 1057 Topics by 734 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Up two levels, $Top.Top.Value ?

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

Page: 1
Go to End
Author Topic: 1039 Views
  • JMagnusson
    Avatar
    Community Member
    29 Posts

    Up two levels, $Top.Top.Value ? Link to this post

    Hello!
    I am trying to reach two levels up. See this:

          <!-- ============================ Here will go a slider ========================== -->
    <div id="slides">
       <div class="slides_container">
          <div id="gallery">
             <% control HeaderObjects %>
                <% if First %>
                <a href="#" class="show">
                <% else %>
                <a href="#">
                <% end_if %>
                   <% control Bild %>
                      <% control CroppedImage(579,221) %>
                         <img alt="$Top.Title" width="579px" height="221px" src="$URL" rel="$Top.Top.Beskrivning"/>
                      <% end_control %>
                   <% end_control %>
                </a>
             <% end_control %>
             <div class="caption"><div class="content"></div></div>
          </div>
          
          <div class="clear"></div>
          <!-- ============================ End of slider ================================== -->
       </div>
    </div>

    This doesn't work. Is there another way, have I done wrong somewhere or is it impossible?

    Many thanks,
    Johan

  • JMagnusson
    Avatar
    Community Member
    29 Posts

    Re: Up two levels, $Top.Top.Value ? Link to this post

    I think that it is impossible this way.
    http://www.silverstripe.org/general-questions/show/6366#post258477
    Maybe I could do it within the control instead, but I think I remove the description for the slider images instead. That will give me a simplier administration area.

    If someone has a better idea maybe you can answere. But I have to do it in another way now.

    Thanks. Johan

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Up two levels, $Top.Top.Value ? Link to this post

    $Top always refers to the absolute top, mostly the (Page)_Controller, not the direct parent control... So, if Beskrivning is a Page property, $Top.Beskrivning would do. As for the Image, instead of using:

    <% control CroppedImage(579,221) %>
       <img alt="$Top.Title" width="579px" height="221px" src="$URL" rel="$Top.Top.Beskrivning"/>
    <% end_control %>

    you could maybe do something like this:

    <img alt="$Title" width="579px" height="221px"
    src="<% control CroppedImage(579,221) %>$URL<% end_control %>" rel="$Top.Beskrivning" />

    1039 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.