How To list the documents of a Space

The following velocity code can be used to list the documents within the space "MySpace".

#foreach ($item in $xwiki.searchDocuments("where doc.web='MySpace'"))
 * [$item]
#end

That can also be used within a class-property, e.g. to construct a field that chooses among the documents of a given space: Just say that this property is of type db-list and leave untouched most other fields except the query field which you fill with:

select doc.name, doc.title
 from com.xpn.xwiki.doc.XWikiDocument as doc
  where doc.web = 'MySpace'
        and doc.name!='WebHome')

editing a class-instance with the default display method doc.display('field-name') then brings a pop-up with the names of all documents of that space.

Version 3.1 last modified by polx on 15/01/2008 at 22:24

Comments 0

No comments for this document

Attachments 0

No attachments for this document

Creator: polx on 2008/01/15 22:16
This wiki is licensed under a Creative Commons license
1.4.1.10194