In your Application.cfc, place your query in a persistent scope (which 
depends upon context).
Change the custom tag to take the query in as an attribute.
Change the custom tag calls to include the attribute, passing in the 
persistent scope var.

Or, if you really can't change the custom tag (youch)...
in the calling page, create a variable that references the persistent 
var (ie: VARIABLES.adQuery = APPLICATION.adQuery). This isn't good 
practice at all, but it will place a reference to the needed var that 
the custom tag can then access without change.

Steve 'Cutter' Blades
Adobe Community Professional
Adobe Certified Expert
Advanced Macromedia ColdFusion MX 7 Developer
____________
http://blog.cutterscrossing.com


Co-Author "Learning Ext JS 3.2" Packt Publishing 2010
https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book

"The best way to predict the future is to help create it"


On 7/28/2011 3:43 AM, Adrian Wagner wrote:
> Hello all. Long no post.
>
> I'm currently working on a module to a an existing, sprawling site that has 
> grown without much planning to a size that was never anticipated.
>
> One of the things I need to do to build my module is switch the existing 
> application.cfm to an application.cfc so that I can use onRequestStart. No 
> big deal But there is one issue that comes up through that.
>
> In application.cfm, they have query the DB for some data regarding site-wide 
> advertising. Just standard cfquery stuff.
>
> Then on the pages, they use a custom tag to actually display the ads.
>
> Now, as soon as I move the queries into the onApplicationStart method in the 
> application.cfc, the trouble starts. The custom tags throw an error. 
> Variables available to it before through the caller scope is now not 
> available anymore.
>
> The cheating way out is to just grab the queries, stick them into their own 
> file and use cfinclude on the pages that advertise.
>
> Is there a way - without changing the custom tag - to include the queries in 
> the application.cfc that will still let the custom tag have access to the 
> variables?
>
> Thanks in advance.
> Adrian
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346383
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to