[xwiki-users] How can I display a subtree with hierarchy macro
Hi,I have the following hierarchy of pages in the same space: page 1└ page 1.1 ├ page 1.1.1 └ page 1.1.2page 2└ page 2.1 On page 1.1, I want to display the subtree from this page (ie. pages 1.1.1 and 1.1.2) but neither page 1 and page 2 tree.I use the hierarchy macro, but I don't kwow how to specify page 1.1 as the root.{{hierarchy space="Intern" excludes="Intern.WebPreferences" displayvalue="displayTitle"/}}Is it possible to do that?Thanks. -- View this message in context: http://xwiki.475771.n2.nabble.com/How-can-I-display-a-subtree-with-hierarchy... Sent from the XWiki- Users mailing list archive at Nabble.com.
I use this macro for that topic {{velocity}} #macro(createDocumentTree $document $depth $level) #if ($depth > 0) #set ($translated = $document.getTranslatedDocument()) #set ($name = $translated.getName()) #set ($fullName = $translated.getFullName()) #set ($prefixedFullName = $translated.getPrefixedFullName()) #set ($where = "where doc.parent = ? or doc.parent = ? or doc.parent = ? order by doc.name") #set ($parameters = [$name, $fullName, $prefixedFullName]) #if ($name == 'WebHome') #set ($space = $document.getSpace()) #set ($where = "where doc.space = ? and (doc.parent = '' or doc.parent = ? or doc.parent = ? or doc.parent = ?) and doc.name != 'WebHome' order by doc.name") #set ($parameters = [$space, $name, $fullName, $prefixedFullName]) #end #foreach ($name in $xwiki.searchDocuments($where, $parameters)) #if ($xwiki.getDocument($name)) #set ($document = $xwiki.getDocument($name)) #set ($translated = $document.getTranslatedDocument()) #set ($prefixed = $translated.getPrefixedFullName()) #set ($title = $translated.getPlainTitle()) ${stringtool.repeat('*', $level)} [[$title>>$prefixed]] #set ($depth = $depth - 1) #set ($level = $level + 1) #createDocumentTree($document $depth $level) #set ($depth = $depth + 1) #set ($level = $level - 1) #end #end #end #end #createDocumentTree($doc 5 1) {{/velocity}} -- View this message in context: http://xwiki.475771.n2.nabble.com/How-can-I-display-a-subtree-with-hierarchy... Sent from the XWiki- Users mailing list archive at Nabble.com.
Thanks a lot! That's exactly what Im' looking for. And I learned to create a macro with this page: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial <http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial> By the way, it's just too bad that hierarchy macro cannot do that... (I come from confluence world and pages hierachy is more accessible than in xwiki). -- View this message in context: http://xwiki.475771.n2.nabble.com/How-can-I-display-a-subtree-with-hierarchy... Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (2)
-
domak -
zzeroo