You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by Odelya YomTov-Glick <od...@jpost.com> on 2008/04/29 17:44:41 UTC

defining macro in weblog.vm

Hi,
I am trying to define a new macro.
I defined in weblog.vm, sitting in the library: \WEB-INF\velocity of the
webapplication. 
#macro (showStringShort $string $size)
   $string.substring(0,$size)
#end

I call it from the template,like this:
#showStringShort("hello" 3)

But it displays:
#showStringShort("hello" 3)
As if the macro doesn't exist.
What did I miss?

Odelya


Re: defining macro in weblog.vm

Posted by Dave <sn...@gmail.com>.
On Tue, Apr 29, 2008 at 11:44 AM, Odelya YomTov-Glick <od...@jpost.com> wrote:
>  I am trying to define a new macro.
>  I defined in weblog.vm, sitting in the library: \WEB-INF\velocity of the
>  webapplication.
>  #macro (showStringShort $string $size)
>    $string.substring(0,$size)
>  #end
>
>  I call it from the template,like this:
>  #showStringShort("hello" 3)
>
>  But it displays:
>  #showStringShort("hello" 3)
>  As if the macro doesn't exist.
>  What did I miss?

I don't see any obvious problem. Did you restart Roller after making
that change?

- Dave