You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by David Esposito <es...@newnetco.com> on 2001/11/21 18:23:38 UTC

just want to confirm one thing

Before i go writing a bunch of code, I just want to confirm that there's no
way to have the #parse directive get a template relative to the template
that it's being called from ...

For example:

\
	\VTL
		\projectA
			homepage.vm
			\include
				header.vm
				footer.vm
		\projectB
			\include
		\projectC
			\include


So, my velocity file.resource.loader.path is /VTL in my velocity.properties
... when I load my template, I do something like
getTemplate("projectA/homepage.vm") ....

inside of homepage.vm, I'd like to do

#parse("include/header.vm")


but #parse looks for "include/header.vm" relative to the
file.resource.loader.path ... not relative to the template that i'm in ...
which is obviously a problem ...

normally I stick a variable onto the context to indicate the directory that
this template is in, but in this particular situation, the building of the
Context is very disjointed from the loading of the Templates ... (the
templates can be found in a few different places ... so i'd have to start
keeping track of where i ultimately found the template) ...

anyway ... i'm a programmer which means that i'm lazy by nature ... just
wanted to make sure there wasn't a way to do it in VTL so i didn't have to
do it in the application code ...

-dave


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: just want to confirm one thing

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 11/21/01 12:23 PM, "David Esposito" <es...@newnetco.com> wrote:

> Before i go writing a bunch of code, I just want to confirm that there's no
> way to have the #parse directive get a template relative to the template
> that it's being called from ...
> 
> For example:
> 
> \
> \VTL
> \projectA
> homepage.vm
> \include
> header.vm
> footer.vm
> \projectB
> \include
> \projectC
> \include
> 
> 
> So, my velocity file.resource.loader.path is /VTL in my velocity.properties
> ... when I load my template, I do something like
> getTemplate("projectA/homepage.vm") ....
> 
> inside of homepage.vm, I'd like to do
> 
> #parse("include/header.vm")
> 
> 
> but #parse looks for "include/header.vm" relative to the
> file.resource.loader.path ... not relative to the template that i'm in ...
> which is obviously a problem ...
>
> normally I stick a variable onto the context to indicate the directory that
> this template is in, but in this particular situation, the building of the
> Context is very disjointed from the loading of the Templates ... (the
> templates can be found in a few different places ... so i'd have to start
> keeping track of where i ultimately found the template) ...
> 
> anyway ... i'm a programmer which means that i'm lazy by nature ... just
> wanted to make sure there wasn't a way to do it in VTL so i didn't have to
> do it in the application code ...
> 

Application code would be the place...

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>