XWiki HowTo's
- Links
- Velocity Macros
- Some Velocity queries
- Create Velocity Macro
Links
Velocity Macros
Some Velocity queries
- Admin rights
#if ($xwiki.hasAdminRights())
The current user has admin rights
#end
- Edit rights
#if($hasEdit)
The current user has edit rights
#end
- Language
#if ($context.language == "de")
German translation is required
#elseif ($context.language == "fr")
French translation is required
#else
THE LANGUAGE "$context.language" IS NOT SUPPORTED.
#end
Create Velocity Macro
A write access to your XWiki installation directory is required!
- Add a new macro to the file "macros.vm"
- see "<xwiki-installation-root>/xwiki/templates"
- add at the end of the file your new macro, for example:
#macro(myMacroName)
Hello World!
#end
- Register the new macro in the file "macros.txt"
- see "<xwiki-installation-root>/xwiki/templates"
- add at the end of the file the line, for example:
myMacroName=velocity:myMacroName:
- After XWiki restart the new velocity macro can be used in a common way: either using the WYSIWYG editor or text mode.