Changes for page Best Practices

Last modified by Vincent Massol on 2017/09/05

From version 1.3
edited by Vincent Massol
on 2007/04/17
Change comment: There is no comment for this version
To version 3.2
edited by Silvia Macovei
on 2010/02/26
Change comment: Fixed Title; Fixed TOC

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +Best Practices
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.VincentMassol
1 +XWiki.SilviaRusu
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 1.0
1 +XWiki 2.0
Content
... ... @@ -1,22 +1,22 @@
1 -1 Best Practices
1 +{{toc/}}
2 2  
3 -#toc("" "" "")
3 += XWiki Application Organization =
4 4  
5 -1.1 Check for Object existence in Class Sheets documents
5 +This [[Best Practices document>>Best Practices XWiki Application Organization]] explains how to best organize an XWiki Application.
6 6  
7 += Check for Object existence in Class Sheets documents =
8 +
7 7  Class sheet documents should be written using the following construct (this is an example for displaying documents containing XWiki.XWikiUsers objects):
8 8  
9 -{code}
10 -\#set($obj = \$doc.getObject("XWiki.XWikiUsers"))
11 -\#if(!$obj)
12 - \1 User Sheet
11 +{{code}}
12 +#set($obj = $doc.getObject("XWiki.XWikiUsers"))
13 +#if(!$obj)
14 + 1 User Sheet
13 13   This stylesheet must be applied on a document containing a XWiki.XWikiUsers object.
14 -\#else
15 - \1 \$msg.get("userProfile", [\$xwiki.getUserName($doc.fullName, false)])
16 +#else
17 + 1 $msg.get("userProfile", [$xwiki.getUserName($doc.fullName, false)])
16 16   ...
17 -\#end
18 -{code}
19 +#end
20 +{{/code}}
19 19  
20 -#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.")
21 -
22 -
22 +{{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.{{/info}}

Get Connected