Re: A WM brain bender

Marc Palmer <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Organization AnyWare Ltd.
Message-ID <[email protected]>
Keats Kirsch wrote:
> Marc Palmer wrote:
> 
>> Keats Kirsch wrote:
>>
>>> Continuing the conversation with myself ...
>>>
>>> Another interesting option would be to change the #eval directive to 
>>> work with Strings as well as Macros.  (I would automatically convert 
>>> the String to a StringMacro).  This would be a simple change.  The 
>>> only downside is that it might make it a bit harder to catch some 
>>> errors.
>>>
>>> Then you could simply say:
>>>
>>> #eval $content.Data using { "contextData": $someData }
>>>
>>> This is kind of cool.  You could even do stuff like:
>>>
>>> #eval "Hello, $userName" using { "userName": $User.Name }
>>
>>
>>
>> That would be the cleanest of them all. #eval was the first thing I 
>> tried.
>>
>> However, is there a shortcut for #eval to make it pass in the caller's 
>> context, so you don't have to pass all the stuff in?
> 
> 
> As documented on the Wiki pages, you can access variables from the 
> callers context via the $OuterVars reference.

Yeah, I meant without any qualification though, so that these template 
fragments to not need to know they are in a #eval block.

They shouldn't know after all, it is an implementation detail of the 
calling template.

#eval <string> using { x }

Would make me happy. At least then I can put the data in as a 
$contentInfo Map and thus hide the $OuterVars concept.

Cheers
-- 
Marc Palmer - - - [email protected]
			
Wangjammers, J2ME Developers
   ~ http://www.wangjammers.org/games/

Blog
   ~ http://www.jroller.com/page/Wangjammer5



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
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.