Jump to:

3432 Posts in 1025 Topics by 865 members

Template Questions

SilverStripe Forums » Template Questions » Nested Controls

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

Page: 1
Go to End
Author Topic: 1432 Views
  • Aperage
    Avatar
    Community Member
    6 Posts

    Nested Controls Link to this post

    Hey hey,

    Is it possible to have nested control?

    I have this code here

    <% control getSpeciesType %>
    <h2>$Type</h2>
    <div class="species">
    <% control ShowSpeciesByType %>
    <h3>$Title</h3>
    <p>$Description</p>
    <% end_control %>
    </div>
    <% end_control %>

    Both custom functions returns a DataObjectSet. But i've tried debugging by putting an exit(); in my nested function (ShowSpeciesByType) but the script doesn't even get there

    So is it possible to have nested Controls??

    Thanks
    Aperage

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: Nested Controls Link to this post

    Yes you can have nested controls but once your in the getSpeciesType control then the scope of the template changes to the SpeciesType object so whatever control you want in that - eg ShowSpeciesByType needs to be a function in the SpeciesType class.

    1432 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.