Re: extend the Include or Environment classes
Denis Bredelet <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello Francis I am not clear what issue you are having with the MultiTemplateLoader. It should try the first loader, and fall back to the second for each #include > Daniel, can you give like a snippet on how to access this @myFramework.include "test2.ftl" inside > the implemented TemplateDirectiveModel class? Im suppose to implement my own stuff inside the execute method right? I'm a little lost on the API. Yes you should write your own code for execute. I think the example in the directive doc is quite clear. -- Denis. > > Again, thanks for replying everyone. I really appreciate it. There's not much detailed examples in the net on Freemarker. Its such a shame because its really a cool templating engine. I'll probably make one if I can get this to work. > > > > I'll try this @myFramework.include "test2.ftl" by Daniel in a while. Just need > > On Wed, Jun 29, 2011 at 5:30 AM, Daniel Dekany <[email protected]> wrote: > Tuesday, June 28, 2011, 2:30:12 PM, Francis Mendoza wrote: > > > Hi Denis, > > > > Thanks for your quick reply. I've had a time to play around with > > the directive at the moment and I seem to get your point. I'm just > > testing stuff out of the example Freemarker gave as per your given link. > > > > Im almost there but I have a question, how can I achieve this: > > > > <@test y="test2.ftl"> > > > > <#include y> > > </@repeat> > > > > and my class "Test" implements TemplateDirectiveModel? How can I > > get the y to be rendered inside the @test? > > I suspects there are some misunderstanding regarding how directives > supposed to work. Why @test is closed with @repeat? Why would y be > visible for the #include when it was just a parameter to @test? > Anyway, if you just wanted something like #include but with a somewhat > different behavior, certainly you should just implement a directive > that does that directly. Something like: > > <@myFramework.include "test2.ftl" /> > > and then in the implementation of "include" you can use the > Environment API to try to include templates, etc. > > Or, as Attila said, maybe a MultiTemplateLoader is the good solution. > > > This may seem like a > > stupid question but im a little dizzy. I know im almost there.... > > > > > > > > > > On Tue, Jun 28, 2011 at 3:55 PM, Denis Bredelet <[email protected]> wrote: > > Hi Francis > > > > > > Hi All, > > > > I'm working right now on shifting our templating engine from > > StringTemplate to Freemarker. One of the requirement > > was that if the .ftl file (an #include) cannot be found, it will > > look for it at the common directory. I've look at the API and > > Freemarker codes but there seem to be no way for me to do this on the "includes". > > > > If the built-in #include does not work for you, you should be able > > to implement it with your own directive: > > > > http://freemarker.org/docs/pgui_datamodel_directive.html > > > > -- Denis. > > > > > > I checked on the Environment.java and saw the rendering of the > > includes down there: getTemplateForInclusion. Its > > a public method alright but then the class is marked final so I > > can't extend it to solve my problem. Is there a possibility > > for this class to be marked as not final on the future releases? > > > > -- > > Francis Mendoza > > > > > > JET Team > > Flight Centre Technology > > Level 4, 545 Queen Street, BRISBANE, QLD 4000. > > Phone: 04231 53500 > > email: [email protected] > > > > ------------------------------------------------------------------------------ > > 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 > > _______________________________________________ > > FreeMarker-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/freemarker-devel > > > > ------------------------------------------------------------------------------ > > 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 > > _______________________________________________ > > FreeMarker-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/freemarker-devel > > > > > > > > > > -- > Best regards, > Daniel Dekany > > > > > -- > Francis Mendoza > > JET Team > Flight Centre Technology > Level 4, 545 Queen Street, BRISBANE, QLD 4000. > Phone: 04231 53500 > email: [email protected] > > ------------------------------------------------------------------------------ > 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 > _______________________________________________ > FreeMarker-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/freemarker-devel ------------------------------------------------------------------------------ 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 _______________________________________________ FreeMarker-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-devel