This is the Velocity we use in our "JAZO TOC":
{{velocity}}
#macro(createTOCTree $document $column_nr)
#set($translated = $document.getTranslatedDocument())
#set($name = $translated.getName())
#set($fullname = $translated.getFullName())
#set($prefixed = $translated.getPrefixedFullName())
#set($where = "where doc.parent = '$name' or doc.parent =
'$fullname' or
doc.parent = '$prefixed' order by doc.name")
#if ($name == "WebHome")
#set($space = $document.getSpace())
#set($where = "where doc.space = '$space' and (doc.parent = '' or
doc.parent = '$name' or doc.parent = '$fullname' or doc.parent =
'$prefixed') and doc.name != 'WebHome' and doc.name !=
'WebPreferences'
order by doc.name")
#end
#set($pages_count = 0)
#foreach($name in $xwiki.searchDocuments($where))
#set($pages_count = $pages_count + 1)
#end
##Er zijn $pages_count links
#set($max_links =
$mathtool.ceil($mathtool.div($pages_count,$mathtool.toInteger($column_nr))))
{{section}}
{{column}}
#foreach($name in $xwiki.searchDocuments($where))
#if ($xwiki.getDocument($name))
#set($document = $xwiki.getDocument($name))
#set($translated = $document.getTranslatedDocument())
#set($prefixed = $translated.getPrefixedFullName())
#set($title = $translated.getDisplayTitle())
[[$title>>$prefixed]]
#if ($foreach.count % $max_links == 0 && $foreach.last == false)
{{/column}}
{{column}}
#end
#end
#end
{{/column}}
{{/section}}
#end
#set($column_count=$xcontext.macro.params.Columns)
#set($my_document=$xcontext.macro.params.Document)
##**Table Of Contents**
#if ("$!my_document"=="")
----
#createTOCTree($doc $column_count)
----
#else
[[**$xwiki.getDocument($my_document).getTranslatedDocument().getDisplayTitle()**>>$xwiki.getDocument($my_document)]]
----
#createTOCTree($xwiki.getDocument($my_document) $column_count)
----
#end
{{/velocity}}
It required two parameters, "Columns" (requried) and "Document"
(optional).
The "Columns" parameter is used to define the number of columns (obviously).
The "Document" is optional, if empty the macro will show the TOC of the
current page, otherwise it will display the TOC of specified document. This
way, our users can create a "main TOC".
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Container-macro-with-more-than-2-columns-…
Sent from the XWiki- Users mailing list archive at
Nabble.com.