Matt said:
> See comments below...
>
> > yeah, no offense intended to David Johnson, but that's a
> > really poor way to use Velocity.  it looks as though that
> > method is intended to spit out some HTML hardcoded into
> > whatever $macros is or some such thing.  the HTML shouldn't
> > come from the java, it should be in the template to begin
> > with, or at least defined the global Velocimacro library.
> > that way the code could just be:
> >
> > #showNavBar( true)
> >
> > anyway, i hope i'm not coming off too argumentative, it's
> > just that these are poor examples of using velocity.  i
> > wouldn't want people to get the wrong idea. :)
>
> As I am a committer on the Roller project - I'm curious to know what a
> better way of implementing this would be.  We do want Roller to be a
> best-practices examples - so any advice is appreciated!

Velocimacros are what you want.  you can create a specify a "library"
template of velocimacros in your velocity.properties that would be available
to all your templates.

see
http://jakarta.apache.org/velocity/user-guide.html#Velocimacros

this provides some nice encapsulation to avoid both hard-coding html or xml
or whatever and yet not have to copy-paste or retype the same stuff every
time.

Nathan Bubna
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to