Gerry-

Very true; you have to be careful when you use $link with #set.

However, if you just print it out without setting it to a variable, it
implicitly calls the toString() method:

$link.setPage("Foo.vm")

Also, 

#set($url = $link.setPage("Foo.vm"))
$url
#set($url2 = $link.setPage("Foo2.vm"))
$url2

will print them correctly, but 

#set($url = $link.setPage("Foo.vm"))
#set($url2 = $link.setPage("Foo2.vm"))
$url
$url2

won't!

David

-----Original Message-----
From: Brian Lawler [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 13, 2004 4:57 PM
To: Turbine Users List
Subject: Re: Using $link multiple times in a page


Gerry-

The toString() method on $link is supposed to clear out the state of 
the object, refreshing back to empty for subsequent usage.  If you are 
doing something like

#set($url = $link.setPage("Foo.vm"))

This will NOT refresh the link back because toString() is not being 
called.  Change a line like this to the following:

#set($url = $link.setPage("Foo.vm").toString())

-Brian



On Friday, February 13, 2004, at 02:22  PM, Gerry Duprey wrote:

> Howdy,
>
> This may seem silly, but I didn't see anything about it on the page 
> where $link is discussed.
>
> If I have a page with actions, URL links, etc, and the $link variable 
> seems to accumulate all the various setTemplate/setAction/etc before 
> it.  So by the third or fourth time I use it, I have a pile of extra 
> "debris" around it.
>
> For example, if I have a form and set the action with a 
> $link.setAction(...) and later have a URL link (not related to the 
> form) where I use $link.setTemplate(...), the resulting URL has the 
> template and an action encoded into it (which causes execution to go 
> through the action when it shouldn't.
>
> Is there some way to reset the $link back to it's original state?  Or, 
> lacking that, is there a way to "clone" it multiple times so each 
> "instance" can have it's own context?
>
> Thanks!
>
> Gerry
> -- 
> Gerry Duprey
> ________________________________________
> SchoolsOPEN, LLC
> 123 North Ashley, Suite 120
> Ann Arbor, MI 48104
> Phone (877) 483-1944 Ext. 401
> Fax (734) 661-0819
>
> Visit us Online at www.Schools-OPEN.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to