You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jim Reesman <ji...@syntricity.com> on 2001/08/20 04:11:11 UTC

Velocity #include, #parse problem (template not found)

Hi,

I'm trying to use Velocity #include and #parse directives, but can't seem to
get them
to work. Velocity.log reports

[info] ResourceManager : found navigations/breadcrumbs.vm with loader blah,
blah...
[error] #include : cannot find navigations/breadcrumbs.vm template!

when handling a .vm that contains

$navigation.setTemplate("breadcrumbs.vm")

and

#include("navigations/breadcrumbs.vm")

The .path property is set properly and reported correctly in velocity.log
(and all
'automatically' loaded templates are working fine...).

Is there a known explanation for this, or can someone please give me some
pointers
on what to check as I begin to debug this?

Thanks,

Jim


Re: Velocity #include, #parse problem (template not found)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jim Reesman wrote:
> 
> I appreciate the reply, but 'navigations' isn't in the path for the
> resource loader. I took your reply on Velocity-User to mean "this is
> a Turbine issue - go ask over there...".

:)

I assume that Turbine does a kind of 'search' for templates when using
the turbine infrastructure?  so it would go look in a predetermined
directory structure?

Where relative to /templates is /navigation?

geir

> 
> Here are the only resource.loader entries in TR.properties
> 
> services.VelocityService.resource.loader = file
> services.VelocityService.file.resource.loader.description = Velocity File
> Resource Loader
> services.VelocityService.file.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> services.VelocityService.file.resource.loader.path = /templates
> services.VelocityService.file.resource.loader.cache = false
> services.VelocityService.file.resource.loader.modificationCheckInterval = 2
> 
> services.VelocityService.resource.loader = classpath
> services.VelocityService.classpath.resource.loader.description = Velocity
> Classpath Resource Loader
> services.VelocityService.classpath.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> 
> Jim
> 
> -----Original Message-----
> From: gmj@mta5.srv.hcvlny.cv.net [mailto:gmj@mta5.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Sunday, August 19, 2001 8:14 PM
> To: turbine-user@jakarta.apache.org
> Subject: Re: Velocity #include, #parse problem (template not found)
> 
> Jim Reesman wrote:
> >
> > Hi,
> >
> > I'm trying to use Velocity #include and #parse directives, but can't seem
> to
> > get them
> > to work. Velocity.log reports
> >
> > [info] ResourceManager : found navigations/breadcrumbs.vm with loader
> blah,
> > blah...
> > [error] #include : cannot find navigations/breadcrumbs.vm template!
> >
> > when handling a .vm that contains
> >
> > $navigation.setTemplate("breadcrumbs.vm")
> >
> > and
> >
> > #include("navigations/breadcrumbs.vm")
> 
> I answered this over on the Velocity list.
> 
> Velocity checks for templates based on the nodes listed in it's
> loader.path property, so if "navigations" is a node in the path list for
> the file resource loader, then you mustn't specify "navigations" again
> in the #include(), unless there is a "navigations" directory under
> "navigations".
> 
> geir
> 
> > The .path property is set properly and reported correctly in velocity.log
> > (and all
> > 'automatically' loaded templates are working fine...).
> >
> > Is there a known explanation for this, or can someone please give me some
> > pointers
> > on what to check as I begin to debug this?
> >
> 
> --
> Geir Magnusson Jr.                           geirm@optonline.net
> System and Software Consulting
> Developing for the web?  See http://jakarta.apache.org/velocity/
> Well done is better than well said - New England Proverb
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb

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


Re: Velocity #include, #parse problem (template not found)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jim Reesman wrote:
> 
> I have found that #parse works as advertised unless it is _after_
> a $navigation.setTemplate(), at which point it will
> fail to find the same template that it found _before_ the
> $naviation.setTemplate(). In the following, the first #parse
> works and the second fails to find the template!
> 
> <tr>
>   <td colspan="3"> #parse ("breadcrumbs.vm") </td>
> </tr>
> <tr>
>  <td colspan="3">$navigation.setTemplate("banner.vm")</td>
> </tr>
> <tr>
>  <td colspan="3"> #parse ("breadcrumbs.vm") </td>
> </tr>
> 
> Suggestions are most welcome at this point... :-)

Hm.  I think I will resume lurking - there is something Turbine related
going on here because the above code is 100% fine WRT Velocity. ( I
would remove the space between #parse and (, but that's just me...)

what does $nav.setTemplate() do?  

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb

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


RE: Velocity #include, #parse problem (template not found)

Posted by Jim Reesman <ji...@syntricity.com>.
I have found that #parse works as advertised unless it is _after_
a $navigation.setTemplate(), at which point it will
fail to find the same template that it found _before_ the
$naviation.setTemplate(). In the following, the first #parse
works and the second fails to find the template!

<tr>
  <td colspan="3"> #parse ("breadcrumbs.vm") </td>
</tr>
<tr>
 <td colspan="3">$navigation.setTemplate("banner.vm")</td>
</tr>
<tr>
 <td colspan="3"> #parse ("breadcrumbs.vm") </td>
</tr>

Suggestions are most welcome at this point... :-)

Thanks,

Jim

-----Original Message-----
From: Jim Reesman [mailto:jim.reesman@syntricity.com]
Sent: Monday, August 20, 2001 9:04 AM
To: turbine-user@jakarta.apache.org
Subject: RE: Velocity #include, #parse problem (template not found)


I appreciate the reply, but 'navigations' isn't in the path for the
resource loader. I took your reply on Velocity-User to mean "this is
a Turbine issue - go ask over there...".

Here are the only resource.loader entries in TR.properties

services.VelocityService.resource.loader = file
services.VelocityService.file.resource.loader.description = Velocity File
Resource Loader
services.VelocityService.file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
services.VelocityService.file.resource.loader.path = /templates
services.VelocityService.file.resource.loader.cache = false
services.VelocityService.file.resource.loader.modificationCheckInterval = 2

services.VelocityService.resource.loader = classpath
services.VelocityService.classpath.resource.loader.description = Velocity
Classpath Resource Loader
services.VelocityService.classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

Jim

-----Original Message-----
From: gmj@mta5.srv.hcvlny.cv.net [mailto:gmj@mta5.srv.hcvlny.cv.net]On
Behalf Of Geir Magnusson Jr.
Sent: Sunday, August 19, 2001 8:14 PM
To: turbine-user@jakarta.apache.org
Subject: Re: Velocity #include, #parse problem (template not found)


Jim Reesman wrote:
>
> Hi,
>
> I'm trying to use Velocity #include and #parse directives, but can't seem
to
> get them
> to work. Velocity.log reports
>
> [info] ResourceManager : found navigations/breadcrumbs.vm with loader
blah,
> blah...
> [error] #include : cannot find navigations/breadcrumbs.vm template!
>
> when handling a .vm that contains
>
> $navigation.setTemplate("breadcrumbs.vm")
>
> and
>
> #include("navigations/breadcrumbs.vm")

I answered this over on the Velocity list.

Velocity checks for templates based on the nodes listed in it's
loader.path property, so if "navigations" is a node in the path list for
the file resource loader, then you mustn't specify "navigations" again
in the #include(), unless there is a "navigations" directory under
"navigations".

geir


> The .path property is set properly and reported correctly in velocity.log
> (and all
> 'automatically' loaded templates are working fine...).
>
> Is there a known explanation for this, or can someone please give me some
> pointers
> on what to check as I begin to debug this?
>

--
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb

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


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


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


RE: Velocity #include, #parse problem (template not found)

Posted by Jim Reesman <ji...@syntricity.com>.
I appreciate the reply, but 'navigations' isn't in the path for the
resource loader. I took your reply on Velocity-User to mean "this is
a Turbine issue - go ask over there...".

Here are the only resource.loader entries in TR.properties

services.VelocityService.resource.loader = file
services.VelocityService.file.resource.loader.description = Velocity File
Resource Loader
services.VelocityService.file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
services.VelocityService.file.resource.loader.path = /templates
services.VelocityService.file.resource.loader.cache = false
services.VelocityService.file.resource.loader.modificationCheckInterval = 2

services.VelocityService.resource.loader = classpath
services.VelocityService.classpath.resource.loader.description = Velocity
Classpath Resource Loader
services.VelocityService.classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

Jim

-----Original Message-----
From: gmj@mta5.srv.hcvlny.cv.net [mailto:gmj@mta5.srv.hcvlny.cv.net]On
Behalf Of Geir Magnusson Jr.
Sent: Sunday, August 19, 2001 8:14 PM
To: turbine-user@jakarta.apache.org
Subject: Re: Velocity #include, #parse problem (template not found)


Jim Reesman wrote:
>
> Hi,
>
> I'm trying to use Velocity #include and #parse directives, but can't seem
to
> get them
> to work. Velocity.log reports
>
> [info] ResourceManager : found navigations/breadcrumbs.vm with loader
blah,
> blah...
> [error] #include : cannot find navigations/breadcrumbs.vm template!
>
> when handling a .vm that contains
>
> $navigation.setTemplate("breadcrumbs.vm")
>
> and
>
> #include("navigations/breadcrumbs.vm")

I answered this over on the Velocity list.

Velocity checks for templates based on the nodes listed in it's
loader.path property, so if "navigations" is a node in the path list for
the file resource loader, then you mustn't specify "navigations" again
in the #include(), unless there is a "navigations" directory under
"navigations".

geir


> The .path property is set properly and reported correctly in velocity.log
> (and all
> 'automatically' loaded templates are working fine...).
>
> Is there a known explanation for this, or can someone please give me some
> pointers
> on what to check as I begin to debug this?
>

--
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb

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


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


Re: Velocity #include, #parse problem (template not found)

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Jim Reesman wrote:
> 
> Hi,
> 
> I'm trying to use Velocity #include and #parse directives, but can't seem to
> get them
> to work. Velocity.log reports
> 
> [info] ResourceManager : found navigations/breadcrumbs.vm with loader blah,
> blah...
> [error] #include : cannot find navigations/breadcrumbs.vm template!
> 
> when handling a .vm that contains
> 
> $navigation.setTemplate("breadcrumbs.vm")
> 
> and
> 
> #include("navigations/breadcrumbs.vm")

I answered this over on the Velocity list.

Velocity checks for templates based on the nodes listed in it's
loader.path property, so if "navigations" is a node in the path list for
the file resource loader, then you mustn't specify "navigations" again
in the #include(), unless there is a "navigations" directory under
"navigations".

geir

 
> The .path property is set properly and reported correctly in velocity.log
> (and all
> 'automatically' loaded templates are working fine...).
> 
> Is there a known explanation for this, or can someone please give me some
> pointers
> on what to check as I begin to debug this?
> 

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb

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