control structures in macros

This question is in reference to Atlassian Documentation: User Macro Template Syntax

I'm looking for the syntax for control structures like #foreach - what else is available? I want to show all the spaces, similiar to, but I get a timeout, so I want to exit the foreach at a certain count... unless I can figure out a different way to limit getAllSpaces().

3 answers

There are also if statements. What are you trying to do?

0 votes
Stephen Deutsch Community Champion Dec 15, 2015

You can use the #break command to break out of a #foreach loop.  More information about Velocity itself can be found on this page:

I think Confluence uses Velocity 1.6, and they do not have any plugins installed, so no MathTool, SortTool, etc.

Thanks! I got #break to work (I guess I wasn't doing it correctly the first time I tried). Now I just have to figure out how to partially query spaces, because the foreach over $spaceManager.getAllSpaces() times out after 13 or so.  Using a version of this:

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

62 views 3 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you