Hi Guys,
I too am having a little bit of a problem with the macros and i'm afraid i
didn't really understand much about how the file resource loaders work when i
looked at this page http://jakarta.apache.org/velocity/developer-guide.html.
I have a working macro defined in menu.vm.
i've added
velocimacro.library = menu.vm
to my
velocity.properties.fileloader
but it doesn't appear to find my macro.
I the template I am just calling
#makemenu( $node "70%" 1)
do i need to do a #parse("menu.vm") ?
Thanks in advance
Andrew M
On Wed July 6 2005 1:01 pm, E.R. van Es wrote:
> Hi Simon,
>
> tested this right away and it works excellent, many thanks here.
>
> Eric
>
> On Wed, 6 Jul 2005 12:41:47 +0100
>
> Simon Christian <[EMAIL PROTECTED]> wrote:
> > Hi Eric,
> >
> > Your observations are correct, that the parsed-in macro won't be
> > available on the first request. If you want to use the macro within
> > multiple templates (as would typically be the case), you should add a
> > line to your velocity.properties file:
> >
> > velocimacro.library = macro.vm
> >
> > Velocity will look for that file in your usual macro path(s). There
> > are further options, which you can read about within the developer
> > guide: http://jakarta.apache.org/velocity/developer-guide.html
> >
> > - simon
> >
> > On 6 Jul 2005, at 12:09, E.R. van Es wrote:
> > > Hello,
> > >
> > > I use JBoss-4.0.1sp1 server, my application uses velocity-1.3.1.
> > > I use velocity to create the html pages, and have the following two
> > > templates:
> > > (note: I simplified the code somewhat...)
> > >
> > > ------- macro.vm --------
> > > #macro ( test $nr )
> > > $nr
> > > #end
> > > -------- end macro.vm -------
> > >
> > > ------- index.vm ---------
> > > #parse("macro.vm")
> > > <html>
> > > <body>
> > > #test(1)
> > > #test(2)
> > > </body>
> > > </html>
> > > ------ end index.vm -----
> > >
> > > Now I deploy this application on JBoss and open the index page
> > > through the servlet. The very first time I open the page, I get
> > > this output:
> > > --- output ----
> > > #test(1)
> > > #test(2)
> > > --- end output ---
> > >
> > > now when I refresh the page, I get:
> > > --- output ---
> > > 1
> > > 2
> > > --- output ---
> > >
> > > so the first time it won't execute the macro...? This only happens
> > > the first time opening the page after a new deployement. When I
> > > copy the whole macro into the index.vm file it works, also the
> > > first time after deployement, but I need the macro in more files,
> > > so I want the macro in a seperate file.
> > >
> > > Looking forward to any reply,
> > > Eric
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]