[xwiki-users] Accessing the macro parameter in velocity code?
Hi All, i am on xwiki 3.5. i have created a macro and included in my TestPage with below code *{{RecentChangesMacro rcSpace="MySpaceName"}}{{/RecentChangesMacro}}* Now in RecentChangesMacro , i have below code , which tries to access the above passed parameter inside velocity template *#set($rcSpace1 = $xontext.macro.params.rcSpace)* but when i print it with below snippet *Value of rcSpace1 is $rcSpace1* the output is *"Value of rcSpace1 is $rcSpace1" *where expected the output is * "Value of rcSpace1 is MySpaceName".* I am not sure why i am able to access the parameter rcSpace in macro? For information, i have also attached the object of "WikiMacroParameterClass" with parameter name "rcSpace" as explained at http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial. Regards
On Thu, Aug 9, 2012 at 9:42 AM, mohit gupta <[email protected]> wrote:
Hi All,
i am on xwiki 3.5. i have created a macro and included in my TestPage with below code *{{RecentChangesMacro rcSpace="MySpaceName"}}{{/RecentChangesMacro}}*
Now in RecentChangesMacro , i have below code , which tries to access the above passed parameter inside velocity template
*#set($rcSpace1 = $xontext.macro.params.rcSpace)*
"xontext"?
but when i print it with below snippet *Value of rcSpace1 is $rcSpace1*
the output is *"Value of rcSpace1 is $rcSpace1" *where expected the output is * "Value of rcSpace1 is MySpaceName".*
I am not sure why i am able to access the parameter rcSpace in macro?
For information, i have also attached the object of "WikiMacroParameterClass" with parameter name "rcSpace" as explained at http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial.
This mailing list doesn't accept attachments. You can paste your code somewhere on the web (e.g. http://pastebin.com ). Marius
Regards _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Thu, Aug 9, 2012 at 8:42 AM, mohit gupta <[email protected]> wrote:
Hi All,
i am on xwiki 3.5. i have created a macro and included in my TestPage with below code *{{RecentChangesMacro rcSpace="MySpaceName"}}{{/RecentChangesMacro}}*
Now in RecentChangesMacro , i have below code , which tries to access the above passed parameter inside velocity template *#set($rcSpace1 = $xontext.macro.params.rcSpace)*
Is this a bad copy past or you really used $xontext insead of $xcontext ?
but when i print it with below snippet *Value of rcSpace1 is $rcSpace1*
the output is *"Value of rcSpace1 is $rcSpace1" *where expected the output is * "Value of rcSpace1 is MySpaceName".*
I am not sure why i am able to access the parameter rcSpace in macro?
For information, i have also attached the object of "WikiMacroParameterClass" with parameter name "rcSpace" as explained at http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial.
Regards _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Thanks Thomas and Marius. It was typo mistake. On Thu, Aug 9, 2012 at 12:29 PM, Thomas Mortagne <[email protected]>wrote:
On Thu, Aug 9, 2012 at 8:42 AM, mohit gupta <[email protected]> wrote:
Hi All,
i am on xwiki 3.5. i have created a macro and included in my TestPage with below code *{{RecentChangesMacro rcSpace="MySpaceName"}}{{/RecentChangesMacro}}*
Now in RecentChangesMacro , i have below code , which tries to access the above passed parameter inside velocity template *#set($rcSpace1 = $xontext.macro.params.rcSpace)*
Is this a bad copy past or you really used $xontext insead of $xcontext ?
but when i print it with below snippet *Value of rcSpace1 is $rcSpace1*
the output is *"Value of rcSpace1 is $rcSpace1" *where expected the output is * "Value of rcSpace1 is MySpaceName".*
I am not sure why i am able to access the parameter rcSpace in macro?
For information, i have also attached the object of "WikiMacroParameterClass" with parameter name "rcSpace" as explained at http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial.
Regards _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
Marius Dumitru Florea -
mohit gupta -
Thomas Mortagne