On Mon, Jan 5, 2009 at 4:15 PM, Jude Robinson
<[email protected]> wrote:
>> Oh, and if you were using Velocity 1.6.1, then you could use #parse to
>> load your macros.
>
> <finally stops lurking/> Hello.
>
> Using #parse to load macros - that sounds interesting - can you give
> an example, and explain when/why that may be useful?


i don't think it's often useful; most of the time there's another,
better way.  but there are those who have needed it.  not having been
one myself, i don't have a great example.  but here's a made up one:

---foo.vm----
#macro(  link $page )http://foo.com/$page#end
#macro(  blah $x )Do y with $x here#end
...

---bar.vm----
#macro( link $page )http://bar.com/$page#end
#macro( blah $x )Do z with $x here#end
...

---template.vm----
#if( $user.foo )
#parse( 'foo.vm' )
#else
#parse( 'bar.vm' )
#end
Hello $user.name,
<a href="#link( 'home.html' )">#blah( 'your account' )</a>.
sincerely,
george of the jungle

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to