The CALLER scope is used to overwrite a variable in the scope for the
calling template if it exists or to initialize one if it doesn't. This is
often not desirable because it makes the CustomTag tightly coupled with the
calling template, reducing the modularity of CustomTags.

If you want to pass values back to the calling tag and keep the CustomTag
independent, you can pass a return variable as a CustomTag attribute, the
custom tag then will set the return value using this variable name in a
caller scope.
ex.
<!--- Calling Template --->
<cf_MyTag FirstName="#FName#" return="CapFirstName">

<!--- Custom Tag --->
...some code....
<cfset "CALLER.#Attributes.return#"=myNewValue>

(A side note: many older custom tag used this method, but they used "Name"
for the CT Attribute:
<cf_MyTag FirstName="" Name="CapFirstName"> This is fine in this syntax but
it breaks when you call it as a cfmodule like this: <cfmodule name="MyTag"
name="CapFirstName">, so don't use Name as an attribute for custom tags)....

-S
___________________________________________

  Sean Brown            <[EMAIL PROTECTED]>
  http://www.westcar.com/

  "Either way you get your dog back"
                          -Anonymous
___________________________________________


-----Original Message-----
From: B.Cravens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 09, 2000 12:28 PM
To: [EMAIL PROTECTED]
Subject: Re: CF Guru help needed - Caller Scope questions


You have it a little flip-flopped.

To make variables available to the custom tag, pass them as attributes of
the custom tag.  The caller scope is used inside of the custom tag to pass
any values back to the calling page.  Then those variables are available as
local (Variables) scope variables.

For example, the below example would output "value2"

<!---your calling page--->
<cf_yourcustomtag variable1="somevalue">
<cfoutput>
    #testvar#
</cfoutput>


<!---your custom tag --->
<cfset caller.testvar = "value2">
<cfset testvar = "value1">





----- Original Message -----
From: "Russel Madere" <[EMAIL PROTECTED]>
To: "CF Talk Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 09, 2000 9:48 AM
Subject: CF Guru help needed - Caller Scope questions


> What are the ramifiactions of using the Caller Scope in a Custom tag?  Are
> all of the calling template's variables passed to the custom tag?  Also,
are
> the actual variables passed or is just pointers to the variables?
>
> Russel Madere, Jr.
> Web Developer
>
> "Be good and you will be lonesome.
>  Be lonesome and you will be free.
>  Live a lie and you will live to regret it."
>                           Jimmy Buffett
>                           That's What Living Is To Me
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to