On 9/7/00, Aidan Whitehall penned:
>Can anyone explain what request scope variables are and when to use them? A
>little sample code would be really helpful :-)
>
>CF Studio help has a paragraph on the page "Passing Attribute Values between
>Custom Tags", but it didn't help much and a search on allaire.com didn't
>produce anything valuable.
From what I understand, request is just like any local variables scope.
<cfset variables.dns = "mydatasource">
<cfset attributes.dns = "mydatasource">
<cfset request.dns = "mydatasource">
The difference being, if you need to access the first 2 inside of a
custom tag, you'd have to pass it into the tag then access it with
the attributes scope.
<cf_mytag dsn = #variable.dns#>
or
<cf_mytag dsn = #attributes.dns#>
The inside the custom tag:
<cfquery name="myquery" datasource="#attributes.dns#">
Where with the request variable, you could access it directly.
<cf_mytag>
Then inside:
<cfquery name="myquery" datasource="#request.dns#">
Of course, it's not limited to datasource names. Any variable that
you set outside the tag that you need to access inside the tag can be
accessed directly without referencing them in the caller tag if you
set them with the request scope.
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.