> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf
> Of Jerome Velociter
> Sent: Wednesday, January 30, 2008 3:37 PM
> To: XWiki Users
> Subject: Re: [xwiki-users] Macros in XWiki.org dev guide
> 
> Hello,
> 
> > The dev guides do a fine job explaining the use of groovy and
velocity
> > code snippets.  They also explain how to develop applications and
> > plugins by creating classes.  However they don't do much to explain
the
> > creation of macros; that or I'm failing to find this.
> >
> > I greatly prefer using macros over copy/paste coding snippets into
each
> > article.  I managed to find this lovely article about creating
Radeox
> > macros in xwiki:
> >
http://hritcu.wordpress.com/2007/03/13/xwiki-plugins-tips-and-tricks/
> > but I'm struggling to find info on creating/adding what I believe
are
> > referred to as Velocity Macros (#macroName(var1, var2...)).  I
assume
> > help has been requested on this repeatedly, but I seem to again be
> > having poor luck in my keyword searches.  Looking at trends in macro
> > submissions, Velocity macros seem to be preferable in most cases,
are
> > they?  Does each have strengths and weaknesses?
> 
> You will find Velocity macros documentation in the apache velocity
user
> guide :
> http://velocity.apache.org/engine/releases/velocity-1.5/user-
> guide.html#velocimacros
> (Agreed, did not found that link on first google shot ;))
> Velocity macros are very usefull within XWiki. You can define those
either
> in the macros.vm file of your skin, or inside wiki pages. The first
option
> has the advantage of letting the macros defined be available for every
> document of your wiki; but the file can grow quickly if you have a lot
of
> macros, so the second option is there, precisely for
application-specific
> macros.
> Best practice for this second option is to have one or several
documents
> that contains your application macros, and include that document from
the
> page that will actually use them, with the #includeMacros statement ;
for
> example :
> 
> #includeMacros("MyAppCode.AppMacros")
> 
> A part from that, there is very little XWiki-specific to know to write
> velocity macros within your wiki. You can access the full XWiki API
inside
> your macro as you would usually do when scripting velocity inside a
wiki
> document.
> 
> Hope this help, and we'd be very keen on you contributing your
experience
> with velocimacros for xwiki on the dev guide.
> 
> Regards,
> Jerome.

That's exactly what I wanted to know, thank you!  Now I wonder if
there's some way to get the best of both worlds.  Users without disk
access cannot edit the macros.vm file, and it's a pain to have to
include the code segments every time you want to use it....Just musing
but there must be a way to write a generic call that fetches a segment
from a specified object (or page, whatever) on xwiki and then calls the
contained macro using a variable number of arguments (and only pulls in
the code once per page).

But yes, that's what I needed to know to get started, thanks again.

-Paul Grodt
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to