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.

Template Questions /

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

control children wrong level


Go to End


1144 Views

Avatar
bartvanirsel

Community Member, 96 Posts

4 February 2011 at 2:40am

Hi,

Beneath i have a code example of the problem i encounter. In the second part i do a control Children but the control Children controls the children of the parent of the current page. When removing the menu part, the second part works fine. What could be causing this problem?


<-- menu part -->
                       	    <% if Menu(2) %>
                                            <% control Menu(2) %>
                                                <% if Children %>
                                                        <li class="$LinkingMode"><a href="$Link" class="pijl" title="$Title.XML" class="pijl $LinkingMode">$MenuTitle.XML</a></li>
                                                <% else %>
                                                        <li class="$LinkingMode"><a href="$Link" class="pijl" title="$Title.XML" class="pijl $LinkingMode">$MenuTitle.XML</a></li>
                                                <% end_if %>

                                                <% if LinkOrSection = section %>
                                                    <% if Children %>
                                                        <li class="ie_list">
                                                            <ul>
                                                                <% control Children %>
                                                                    <li><a href="$Link" class="$LinkingMode">$MenuTitle.XML</a></li>
                                                                    <% if LinkOrSection = section %>
                                                                        <% if Children %>
                                                                            <li class="ie_list">
                                                                                <ul>
                                                                                    <% control Children %>
                                                                                    <li><a href="$Link" class="$LinkingMode">$MenuTitle.XML</a></li>
                                                                                    <% end_if %>
                                                                                </ul>
                                                                            </li>
                                                                        <% end_if %>
                                                                    <% end_if %>
                                                                <% end_control %>
                                                            </ul>
                                                        </li>
                                                     <% end_if %>
                                                <% end_if %>
                                            <% end_control %>                            
                            <% end_if %>
                <!-- end menu part -->


                <!-- get children part -->
                                <% control Children %>
                                    <div class="block overzicht tijdschrift">
                                        <h2>$Title</h2>
                                        <p><img src="<% control CoverImage %><% control SetWidth(120) %>$URL<% end_control %><% end_control %>" alt="$Title.XML" /></p>
                                        <a href="$Link" title="$Title.XML">Lees verder</a>
                                    </div>
                                    <% if MultipleOf(3) %>
                                    <div class="clear"></div>
                                    <% end_if %>
                                <% end_control %>
                <!-- end get children part -->