Re: [FreeMarker-user] Can I make user-defined directives part of a hash?
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
From: Newman, J. W <new...@d3...> - 2011-08-17 14:23:53
|
http://freemarker.sourceforge.net/docs/ref_specvar.html I think something like [#assign varName] [@foo.bar param=value /][/#assign] ${vars["foo"][varName]} might be what you are after. -John -----Original Message----- From: Daniel Dekany [mailto:dd...@fr...] Sent: Tuesday, August 16, 2011 8:14 PM To: Chris Cc: fre...@li... Subject: Re: [FreeMarker-user] Can I make user-defined directives part of a hash? Wednesday, August 17, 2011, 12:33:07 AM, Chris wrote: > Suppose I have a data model with some hash variables. The hash > variable "foo" returns a TemplateDirectiveModel named "bar". How do I > call it within a template? > > These don't work: > > ${foo.[@bar param=value/]} (A strange attempt. ${...} is for interpolations, not for directive calls.) > [@foo.bar param=value/] This last should work. What's the error message? > On a related note, it would be nice to be able to temporarily set the > root of the data model to a subvalue. Then you could go: > > [#assign root = root.foo] > [@bar param=value/] > // then set it back here > > It would be like namespacing parts of the data model and then setting > the current namespace. Certainly, however that change should be scoped lexically (right?), so it's certainly not trivial to implement. But yeah, I know of situations that needs multiple data-models... -- Best regards, Daniel Dekany ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ FreeMarker-user mailing list Fre...@li... https://lists.sourceforge.net/lists/listinfo/freemarker-user |