Some people (not necessarily me) believe doing this is better:

<cf_mytag theQuery="#myQuery#"/>

i.e. passing the query by value and hence avoiding breaking any kind of
encapsulation.

Inside the tag you refer to the query in the normal way e.g.

<cfset localQuery = attributes.theQuery>

or just:

<cfloop query="attributes.theQuery">
...
</cfloop>

However, if you follow the syntax of native ColdFusion tags then the
analogous approach is to do what you have opted to do. E.g.

<cf_mytag theQuery="myQuery"/>

Inside the tag:

<cfset localQuery = caller[attributes.theQuery]/>


André

-----Original Message-----
From: Venable, John [mailto:[EMAIL PROTECTED] 
Sent: 13 August 2003 19:13
To: CF-Talk
Subject: RE: Caller access to query

Thanks everyone, I was passing the queryname in as an attribute and
<cfset
_localQuery = Evaluate("Caller." + Attributes.query) /> was just what I
needed. I had to change the + to & for concatenation though.

Thanks

John Venable

-----Original Message-----
From: webguy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 12:58 PM
To: CF-Talk
Subject: RE: Caller access to query


If myquery is the query on your page then in your custom tag

<cfset _localQuery = Caller.myquery />

Better is to pass the query in the tag

        <cf_mytag query="myquery" />

and in the tag

        <cfset _localQuery = Evaluate("Caller." + Attributes.query) />


WG

-----Original Message-----
From: Venable, John [mailto:[EMAIL PROTECTED]
Sent: 13 August 2003 17:45
To: CF-Talk
Subject: Caller access to query


Is there a way to access an existing query recordset from a custom tag
called on the page? So if I have a query in a page, and I call a custom
tag,
can i use the query data through come sort of caller scope object? I
can't
seem to make it work.

Thanks

John Venable



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to