Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## This velocity code will take a list, and split it into two pieces, suitable for
- ## two columns. If the size of the list is odd, it will put the extra item into the first list.
- #set($myListCount = $myList.size())
- #set($halfListCount = $myListCount * 0.5)
- #set($bigHalfCount = $math.ceil($halfListCount))
- #set($smallHalfCount = $math.floor($halfListCount))
- <div class="oneoftwo">
- <ul>
- #set($lastInCol1 = $bigHalfCount - 1)
- #foreach($myNumber in [0 .. $lastInCol1])
- #set($con = $myList.get($myNumber))
- <li><a href="$con.link">$con.shortTitle</a></li>
- #end
- </ul>
- </div>
- <div class="oneoftwo">
- <ul>
- #set($lastInCol2 = $myListCount - 1)
- #foreach($myNumber in [$bigHalfCount .. $lastInCol2])
- #set($con = $myList.get($myNumber))
- <li><a href="$con.link">$con.shortTitle</a></li>
- #end
- </ul>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment