Hi Gregory!
Thanks for your anwer. To explain the situation:
Basically, we have created our own extended version of the
templating-components, based on freemarker directives rather than jsp-tags, and
with extended functionality required by our customer.
To create our "iterate" directive (something like the contentNodeIterator) I
needed to inject the "loop status variable".
I do this as follows:
...
LoopStatus status = new LoopStatus();
//BeansWrapper w = new BeansWrapper();
ObjectWrapper w = FreemarkerConfig.getInstance().getObjectWrapper();
env.setVariable(varStatus, w.wrap(status)); //env is the freemarker
Environment
...
As can be seen from the commented line I originally used BeansWrapper -->
incorrect, as you point out, I need to use magnolia's objectwrapper. That's
what I am now doing, and it is all working fine.
One problem remains: FreemarkerConfig.getInstance() is deprecated. What would
be the "clean" way of getting at FreemarkerConfig?
Thanks!
Regards from Vienna,
Richard
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von
=?ANSI_X3.4-1968?Q?Magnolia_Forums_=28on_behalf_of_Gr=3Fgory_Joseph=29?=
Gesendet: Mittwoch, 01. Juni 2011 18:04
An: Magnolia User List
Betreff: [magnolia-user] Re: Quick Question
Why do you need to do this ? Pass a Content instance to the context
(FreemarkerHelper.render(... Map context ...) and FreeMarker takes care of the
rest.
The nitty-gritty wrapping and conversion job happens when FreemarkerHelper
instructs FreeMarker to use
info.magnolia.freemarker.models.MagnoliaObjectWrapper as its object wrapper.
If you can't find an example of where that's actually, that's for the simple
reason it isn't done anywhere except in MagnoliaObjectWrapper, which isn't
called directly either. Ever.
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=4fcd31ec-0a39-4c31-bc60-0188a1c34528
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to:
<[email protected]<mailto:[email protected]>>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------