#visit / #recurse with alternative macros / display formats

Eirik Lygre <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
We have a couple of scenarios where we use the recursive templating support, 
with #visit or #recurse automatically calling a macro named @Dimensions.

Now, sometimes we want to / need to use the same template for multiple layouts. 
However, since the macro name is determined automatically, we need something 
smart.

1) Is there an obvious solution that we haven't seen?

We were thinking of using namespaces. However, we cannot refer to external 
templates, so we'd need to create macros in different namespaces from the same 
template, which doesn't seem possible:

[#if format == 'full']
   [#visit dimensions using full]
[#else]
   [#visit dimensions]
[#/if]

[#macro @Dimension]        [#-- Default namespace --]
...
[/#macro]

[#macro @full.Dimension]   [#-- Use namespace "full" --]
...
[/#macro]

2) Is this possible? Should it be?

Or, any other suggestions?

Eirik


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.