Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Apache Velocity include in included template

 
Greenhorn
Posts: 2
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

i've got the following Folder Structure
-templates
--template1.vm
--template2.vm
--anotherdirectory
---template3.vm
---template4.vm

in template1.vm i got this code

#include("./templates/anotherdirectoy/template3.vm")

which works nicely

in template3.vm i got the following code

#include("./templates/anotherdirectory/template4.vm")

wich does not work at all in template1

So i've got the situation that the second include in template3 does not work when template3 ist included in template1, hope you all understand what i'm trying to say.

Does anyone have an idea of what the problem could be? Or is this a velocity limiation

EDIT: I think i need to clarify

what happens is that template1 gets used in this template we have included template3 the conents of template 3 are displayed correctly
BUT as mentioned in template3 is template4 included

template1's output looks now the following


"blbalblablabla
content of template 3
#include("./templates/anotherdirectory/template4.vm")"

So the include statement in template3 gets not "included" it only outputs the include statement as statet in the file
 
Max Meyer
Greenhorn
Posts: 2
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fixed it!

The first templates needs to work with #parse instead of #include as #include just puts out text and does not recognize any other statements
 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Max Meyer wrote:Fixed it!


Well done figuring it out yourself and thanks for coming back to share the solution with others.
For all these efforts, you won yourself a cow! Moo!
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad you figured it out (if only because I was about to post a guess which was completely irrelevant)!
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!