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.

General Questions

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

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

Split control loop into 2 columns/ footer menus/ multi column lists


Reply

1075 Views

Avatar
CHD

6 January 2011 at 4:38pm Community Member, 218 Posts

Hi all,

not sure if this is the BEST way to do it, but i just spent half an hour searching the forums and have managed to put this together, so thought i'd share!

i wanted to list some items in a footer menu, using control of page URL.
but there were too many for one column, so i wanted to split the list.

here's what i did:

<dl>
   <dt>Properties</dt>

         <% control Page(properties) %>
         <% control Children %>

   <dd> <a title="$Title" href="$Link">$Title</a></dd>

         <% if Pos = 4 %>
</dl>
   <dl>
         <% end_if %>
<% end_control %>
<% end_control %>
</dl>

so now, it lists 4 items, then closes the list and starts a new one, then continues the control loop.
once it runs out of items to list, it closes and ends.

works perfectly for my needs!

but if anybody knows a cleaner solution please do share.