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.

General Questions /

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

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

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


Go to End


1765 Views

Avatar
CHD

Community Member, 219 Posts

6 January 2011 at 4:38pm

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.