如果你觉得你的页面太简单,只有简单文本,你想丰富你的页面,那么你需要使用xwiki强大的编程API来改造你的页面。 XWiki支持多种脚本语言:Velocity, Groovy, Python, Ruby甚至PHP。
XWiki暴露API,能让您轻松操控wiki及其文档。
为了激起你的兴趣,请把下面的代码嵌入到你的页面:
{{velocity}}
#set($query = "where doc.parent is null or doc.parent='' order by doc.name asc")
#foreach($item in $services.query.xwql($query).execute())
#set($orphanedDoc = $xwiki.getDocument($item))
* [[$orphanedDoc.displayTitle>>$orphanedDoc]] (located in space //$orphanedDoc.space//, contains $orphanedDoc.attachmentList.size() attachments)
#end
{{/velocity}}
你会得到孤立的页面(即页面没有父节点)的列表。 例如:
查看本人博客开发人员指南,特别是脚本部分,以了解更多信息。
您可能还需要在扩展里查查,里面包含了大量的代码片段,你可以获取这些代码在自己的页面中重复利用。