You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Claude Brisson <cl...@savoirweb.com> on 2003/07/01 20:11:08 UTC

Re: problems hooking event handlers in with EventCartridge

Nathan Bubna wrote :

>
> > 3) Is there any way to #parse() a template that isn't in
> > the current directory or subdir?
>
> you should be able to give #parse() a relative path.
> so #parse( '../otherdir/foo.vm' ) ought to work (i do this in some of my
> apps).

It is luck if it worked for you, because according to the actual code, it's not handled at all.

I've implemented it in a first hackish patch (that I posted under bugzilla #18072), and then in a much cleaner patch that I will
submit the day contributions get a chance to be commited (since it involves patching the core...).

This new patch allows the WebappLoader to have several pathes, along with the possibility for those pathes to be relative.

So now I can write :

webapp.resource.loader.path = /WEB-INF/templates
webapp.resource.loader.path = .
webapp.resource.loader.path = /

and my templates are searched successively in /WEB-INF/templates, in the current path (for #include or #parse), and then from the
webapp root.

Cool, isn't it ? If someone is interested I will send him the patch.


CloD



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: problems hooking event handlers in with EventCartridge

Posted by Nathan Bubna <na...@esha.com>.
Claude Brisson said:
> Nathan Bubna wrote :
> > > 3) Is there any way to #parse() a template that isn't in
> > > the current directory or subdir?
> >
> > you should be able to give #parse() a relative path.
> > so #parse( '../otherdir/foo.vm' ) ought to work (i do this in some of my
> > apps).
>
> It is luck if it worked for you, because according to the actual code, it's
not
> handled at all.

oops.  i stand very corrected.  a quick grep of all my templates shows that i
don't do that.  for some reason i thought i did.  i should've checked before i
spoke.  sorry.  thanks for the correction Claude!

> I've implemented it in a first hackish patch (that I posted under bugzilla
#18072),
> and then in a much cleaner patch that I will
> submit the day contributions get a chance to be commited (since it involves
> patching the core...).

appreciated.

> This new patch allows the WebappLoader to have several pathes,

there's a bug for this part already (#17989).  i meant to deal with that once
upon a time but didn't get to it.  thanks for the reminder.  i'll see if i
can't deal with this in the next week or so.

> along with the possibility for those pathes to be relative.
>
> So now I can write :
>
> webapp.resource.loader.path = /WEB-INF/templates
> webapp.resource.loader.path = .
> webapp.resource.loader.path = /
>
> and my templates are searched successively in /WEB-INF/templates, in the
current path (for #include or #parse), and then from the
> webapp root.
>
> Cool, isn't it ? If someone is interested I will send him the patch.

would you mind attaching them to the appropriate bugs?

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org