Wiki source code of BestPractices

Version 2.1 by Ludovic Dubost on 2008/05/20

Show last authors
1 1 Best Practices
2
3 #toc("" "" "")
4
5 1.1 XWiki Application Organization
6
7 This [Best Practices document>Best Practices XWiki Application Organization] explains how to best organize an XWiki Application.
8
9 1.1 Check for Object existence in Class Sheets documents
10
11 Class sheet documents should be written using the following construct (this is an example for displaying documents containing XWiki.XWikiUsers objects):
12
13 {code}
14 #set($obj = $doc.getObject("XWiki.XWikiUsers"))
15 #if(!$obj)
16 1 User Sheet
17 This stylesheet must be applied on a document containing a XWiki.XWikiUsers object.
18 #else
19 1 $msg.get("userProfile", [$xwiki.getUserName($doc.fullName, false)])
20 ...
21 #end
22 {code}
23
24 #info("The 'if' tests first for the non existence. This is so that XWiki extract the title from the ~~1 User Sheet~~, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong.")

Get Connected