[xwiki-devs] Java functions as macro
Thomas Mortagne
thomas.mortagne at xwiki.com
Tue Jul 1 15:11:17 CEST 2008
On Tue, Jul 1, 2008 at 2:52 PM, MikhaelSantos <scan at netvisao.pt> wrote:
>
> Hi guys!
>
> I'm trying to add my own macros on xwiki but they are functions made in
> java.
> for example if I had to edit a xwiki page and added
> xwiki.myplugin.function("Mikhael") on the preview my function would show the
> following Text : "Hello Mikhael your plugin is working!". Now what I want to
> know is how do a turn xwiki.myplugin.function("Mikhael") into for example "
> $hi("Mikhael") "? Give it a more macro look.
I don't really see the point...
If you simply wand to create your own macro calling you plugin method
you can do:
#macro(myfunction $param1)
xwiki.myplugin.function($param1)
#end
then
#myfunction("Mikhael")
You can also store the plugin interface in a variage then call the method:
#set($myplugin = xwiki.myplugin.function("Mikhael"))
$myplugin.function("Mikhael")
By the way calling methods from plugin directly using
xwiki.myplugin.function() is not recommended (especially if you use
the plugin in more than one place in the same document) as any time
you call xwiki.myplugin a new plugin API instance is created.
>
> I look foward to your answers and thank you for helping out
> Mikhael
> --
> View this message in context: http://www.nabble.com/Java-functions-as-macro-tp18214356p18214356.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> devs mailing list
> devs at xwiki.org
> http://lists.xwiki.org/mailman/listinfo/devs
>
--
Thomas Mortagne
More information about the devs
mailing list