Return to Snippet

Revision: 33898
at October 14, 2010 22:43 by kentos


Initial Code
#set ($propertyUtil = $sitevisionUtils.propertyUtil)

#if ($propertyUtil.getNode($portlet, 'menuRoot'))

#set ($rootNode = $propertyUtil.getNode($portlet, 'menuRoot'))
#set ($random = $scriptUtil.getInstance("java.util.Random"))
#set ($nodes = $rootNode.nodes)

#if (!$nodes.isEmpty())
#set ($newnodes = [])
#set ($looplen = $nodes.size())

#foreach ($foo in [1..$looplen])
	#set ($len = $nodes.size())
	#set ($len = $len - 1)
	#if ($len > 0)
		#set ($ix = $random.nextInt($len))
	#else
		#set ($ix = 0)
	#end
	#set ($thenode = $nodes.get($ix))
	#set ($dummy = $newnodes.add($thenode))
	#set ($dummy = $nodes.remove($ix))
#end

#set ($nr = 0)

#foreach ($p in $newnodes)

#if ($nr < 5)
$linkRenderer.update($p)
$linkRenderer.setFontClass($fontClass)

$linkRenderer.render()
#set ($nr = $nr + 1)
#end

#end

#end
#end

Initial URL

                                

Initial Description

                                

Initial Title
Random archive posts in SiteVision

Initial Tags

                                

Initial Language
Other