Jump to:

5521 Posts in 1734 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Nested Controllers

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

Page: 1
Go to End
Author Topic: 1389 Views
  • Brig
    Avatar
    Community Member
    26 Posts

    Nested Controllers Link to this post

    Hello

    I'm in need of some help please. I'm trying to nest two controllers but cannot get it to work.

    Here's my code:

    <% control Members %>
    <div id="$Name" style="display: none;">
    <table class="rostertable" cellpadding="0" cellspacing="0">
    <tr class="rostertr">
    <td class="rostertdleft" colspan="3"><strong>$Name's Alts</strong></td>
    </tr>
    <% control Alts %>
    <tr class="rostertr">
    <td class="rostername">$Name</td>
    <td class="rosterlvl">$Level</td>
    <td class="rosterlvl"><img style="border: none;" src="themes/newdawn/images/magelo.png" alt="Magelo" /></td>
    </tr>
    <% end_control %>
    </table>
    </div>
    <% end_control %>

    When I try this it just ignores the Alts controller. Both controllers are MySQL calls which I've created in my PHP page.

    This is the kind of output I'm after:

    <div id="BexieAlt" style="display: none;">
    <table class="rostertable" cellpadding="0" cellspacing="0">
    <tr class="rostertr">
    <td class="rostertdleft" colspan="3"><strong>BexieAlt's Alts</strong></td>
    </tr>
    <tr class="rostertr">
    <td class="rostername">BexieAlt</td>
    <td class="rosterlvl">78</td>
    <td class="rosterlvl"><img style="border: none;" src="themes/newdawn/images/magelo.png" alt="Magelo" /></td>
    </tr>
    <tr class="rostertr">
    <td class="rostername">BexieAlt2</td>
    <td class="rosterlvl">78</td>
    <td class="rosterlvl"><img style="border: none;" src="themes/newdawn/images/magelo.png" alt="Magelo" /></td>
    </tr>
    ...
    ...
    ...
    </table>
    </div>

    Could someone be so kind and offer me some hints to how I can solve this please? It's the final bit of a quite large website project so I'm very eager to get it working!

  • robinp
    Avatar
    Community Member
    33 Posts

    Re: Nested Controllers Link to this post

    Hi,

    This does partly depend I how you have got your dataobjects set up but I have feeling instead of

    <% control Alts %>

    You need

    <% control Top.Alts %>

    Does that work for you ?

    Cheers

    Robin

  • Brig
    Avatar
    Community Member
    26 Posts

    Re: Nested Controllers Link to this post

    Wow that worked! Thanks so much for the help!

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