The few times I used macros I passed objects and accessed the object
properties inside the macro.

Try using the formal notation:

#urlencode(${article.linkurl})
#urlencode("Test ${article.linkurl}")


2009/6/13 Jonathon Rossi <[email protected]>

> Macro's aren't really supported because there are quite a lot of issues
> with them.
>
> It would be less painful to create a helper class (which it looks like you
> already have) with the functionality of the macro, which also makes it
> testable.
>
> On Wed, Jun 10, 2009 at 4:11 AM, Mike Bridge <[email protected]>wrote:
>
>>
>> Hi-
>>
>> I was wondering if this should work:
>>
>> #macro(urlencode $querystring)$nvurlutils.urlencode($querystring)#end
>>
>>    #set($url = "Test $article.linkurl")
>>
>>    Test 1: $nvurlutils.urlencode("Test $article.linkurl")
>>    Test 2: #urlencode($url)
>>    Test 3: #urlencode($article.linkurl)
>>    Test 4: #urlencode("Test $article.linkurl")
>>
>> What I'm getting is:
>>
>>     Test 1: Test+http%3a%2f%2fwww.google.ca%2fsearch%3fq%3dCastle
>>     Test 2: Test+http%3a%2f%2fwww.google.ca%2fsearch%3fq%3dCastle
>>     Test 3:
>>     Test 4: Test
>>
>> Test 1 & 2 are as expected, but Test 3 & 4 don't seem to dereference
>> my object & data accessor inside the macro.
>>
>> I'm wondering why I can't seem to pass in an object reference---is it
>> a scoping problem in the macro?   As I understand it, a macro
>> parameter is passed by name and is dereferenced inside the macro, but
>> for some reason it doesn't seem to be available there.
>>
>> Thanks,
>>
>> -Mike
>>
>>
>>
>
>
> --
> Jono
>
>
> >
>


-- 

Ricardo Lopes

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to