Writing an [@include] directive
Chris <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
We have to write our own [@include] directive and I'm having problems. The reason we need to do this is that each file we include needs to have its own datamodel, and not necessarily use the parent datamodel. We've also got to bypass the default template loading and template caching code. I'm running into problems. If I try to fetch and process an external template from within a TemplateDirectiveModel, it fails to process more than one @include in a file. I'm having a hard time tracing the problem, but I suspect it's because the Environment is shared between the parent template and the included template. Environment is stored in a static thread local variable. This is just a guess. If I put env.include(myIncludedTemplate) within the body of the TemplateDirectiveModel it works, but it makes it hard to swap datamodels. Any thoughts or insight would be appreciated. ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2