Wiki source code of XWiki HowTo’s

Version 2.1 by Roman Friesen on 2009/09/15 11:54

Show last authors
1 = XWiki HowTo's =
2
3 {{toc start="2" numbered="true" depth="3"/}}
4
5 == Links ==
6
7 * [[Changing the skin >>http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Skins]]
8 * [[Advanced (Developer) guide >>http://platform.xwiki.org/xwiki/bin/view/DevGuide/]]
9 * [[Developer guide >>http://dev.xwiki.org/xwiki/bin/view/Main/]]
10 * [[Code Zone >>http://code.xwiki.org/xwiki/bin/view/Main/]]
11 * [[wiki using API >>http://platform.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D2.0%2Drc%2D1%2Djavadoc.jar/index.html]]
12
13 == Velocity Macros ==
14
15 === Some Velocity queries ===
16 * Admin rights
17 {{code}}
18 #if ($xwiki.hasAdminRights())
19 The current user has admin rights
20 #end
21 {{/code}}
22
23 * Edit rights
24 {{code}}
25 #if($hasEdit)
26 The current user has edit rights
27 #end
28 {{/code}}
29
30 * Language
31 {{code}}
32 #if ($context.language == "de")
33 German translation is required
34 #elseif ($context.language == "fr")
35 French translation is required
36 #else
37 THE LANGUAGE "$context.language" IS NOT SUPPORTED.
38 #end
39 {{/code}}
40
41 === Create Velocity Macro ===
42
43 {{warning}}A write access to your XWiki installation directory is required!{{/warning}}
44
45 1. Add a new macro to the file "macros.vm"
46 1*. see "<xwiki-installation-root>/xwiki/templates"
47 1*. add at the end of the file your new macro, for example:
48 {{code}}#macro(myMacroName)
49 Hello World!
50 #end{{/code}}
51 1. Register the new macro in the file "macros.txt"
52 1*. see "<xwiki-installation-root>/xwiki/templates"
53 1*. add at the end of the file the line, for example:
54 {{code}}myMacroName=velocity:myMacroName:{{/code}}
55 1. After XWiki restart the new velocity macro can be used in a common way: either using the WYSIWYG editor or [[text mode>>http://code.xwiki.org/xwiki/bin/view/Macros/]].