Re: UDF within a Custom Tag

2004-07-22 Thread Mike Chabot
This thread got me thinking about my code in CFMX 6.1. If I have a cfscript-based UDF inside of a custom tag, and that function is only called in the executionmode=end block, is it a best-practice to declare that function in the end block, or does it not matter where the fuction is defined inside

UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
I have had a problem a couple times when I've tried to put a UDF within a custom tag. CF insists that the function has been declared more than once. I figured this was because of the sort of doubling effect the start/end execution modes have, but the problem persists even when I have cfif

RE: UDF within a Custom Tag

2004-07-21 Thread Robertson-Ravo, Neil (RX)
You are getting this error as by default Custom Tags are called twice internally AFAIK.. _ From: Jamie Jackson [mailto:[EMAIL PROTECTED] Sent: 21 July 2004 16:25 To: CF-Talk Subject: UDF within a Custom Tag I have had a problem a couple times when I've tried to put a UDF within a custom

Re: UDF within a Custom Tag

2004-07-21 Thread Raymond Camden
method=EXITTAG No need to check execution mode. This one line will simply make the custom tag run in start mode. On Wed, 21 Jul 2004 11:25:25 -0400, Jamie Jackson [EMAIL PROTECTED] wrote: I have had a problem a couple times when I've tried to put a UDF within a custom tag. CF insists

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 16:38:03 +0100, in cf-talk you wrote: You are getting this error as by default Custom Tags are called twice internally AFAIK.. So are UDFs not allowed within Custom Tags? I also tried wrapping the function declaration in a testing conditional: cfif not isdefined(doOption)

RE: UDF within a Custom Tag

2004-07-21 Thread Robertson-Ravo, Neil (RX)
Yeah...see Ray's comments...I skipped 6.0 out altogetheras it was way too unstable!Ray is the man he is Mr UDF ;-) _ From: Jamie Jackson [mailto:[EMAIL PROTECTED] Sent: 21 July 2004 16:52 To: CF-Talk Subject: Re: UDF within a Custom Tag On Wed, 21 Jul 2004 16:38:03 +0100, in cf-talk you

Re: UDF within a Custom Tag

2004-07-21 Thread Ben Doom
I'd set a request-scoped variable just before or after my function declaration (ie request.functionnameIsDeclared or something else you'll never use anywhere else) and check for its existence. --Ben Jamie Jackson wrote: On Wed, 21 Jul 2004 16:38:03 +0100, in cf-talk you wrote: You are

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
the only thing I don't like about it is it's kinda buried down there. Cleaner, though. On Wed, 21 Jul 2004 11:25:25 -0400, Jamie Jackson [EMAIL PROTECTED] wrote: I have had a problem a couple times when I've tried to put a UDF within a custom tag. CF insists that the function has been declared more

Re: UDF within a Custom Tag

2004-07-21 Thread Raymond Camden
AFAIK.. _ From: Jamie Jackson [mailto:[EMAIL PROTECTED] Sent: 21 July 2004 16:25 To: CF-Talk Subject: UDF within a Custom Tag I have had a problem a couple times when I've tried to put a UDF within a custom tag. CF insists that the function has been declared more than once. I figured

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 12:00:48 -0400, Ben Doom [EMAIL PROTECTED] wrote: I'd set a request-scoped variable just before or after my function declaration (ie request.functionnameIsDeclared or something else you'll never use anywhere else) and check for its existence. --Ben Doh! Why didn't I think

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 12:11:13 -0400, in cf-talk you wrote: On Wed, 21 Jul 2004 10:45:21 -0500, Raymond Camden [EMAIL PROTECTED] wrote: Are you still running 6.0? I believe they fixed this in 6.1. Nope, running 6.1. Any ideas with that in mind? Might I be doing something wrong? Whoops, I forgot

RE: UDF within a Custom Tag

2004-07-21 Thread Robertson-Ravo, Neil (RX)
Yeah, sorry ray...I just seen Tag Execution but and whacked on the keyboard ;-) _ From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: 21 July 2004 17:12 To: CF-Talk Subject: Re: UDF within a Custom Tag This is not true. If you do cf_foo it will certainly NOT run twice. It will only run

RE: UDF within a Custom Tag

2004-07-21 Thread Kola Oyedeji
I believe this is a known bug - stumbled across it myself a while back. Since then I have resorted to declaring udfs outside a tag Kola -Original Message- From: Jamie Jackson [mailto:[EMAIL PROTECTED] Sent: 21 July 2004 17:17 To: CF-Talk Subject: Re: UDF within a Custom Tag On Wed

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 12:00:48 -0400, in cf-talk you wrote: I'd set a request-scoped variable just before or after my function declaration (ie request.functionnameIsDeclared or something else you'll never use anywhere else) and check for its existence. --Ben That's a great idea, and one I

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 17:36:07 +0100, in cf-talk you wrote: I believe this is a known bug - stumbled across it myself a while back. Since then I have resorted to declaring udfs outside a tag Kola Darn, should have been easy to have private methods in Custom Tags. Oh well, thanks for the sanity

Re: UDF within a Custom Tag

2004-07-21 Thread Qasim Rasheed
What about using isCustomFunction() or isFunction from http://cflib.org/udf.cfm?ID=286 Qasim - Original Message - From: Jamie Jackson [EMAIL PROTECTED] Date: Wed, 21 Jul 2004 11:51:39 -0400 Subject: Re: UDF within a Custom Tag To: CF-Talk [EMAIL PROTECTED] On Wed, 21 Jul 2004 16:38:03

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 13:29:40 -0400, in cf-talk you wrote: What about using isCustomFunction() or isFunction from http://cflib.org/udf.cfm?ID=286 Qasim I just tried your suggestion, and it behaved the same as if I didn't have the conditional in there at all: cfif NOT

Re: UDF within a Custom Tag

2004-07-21 Thread Qasim Rasheed
Message - From: Jamie Jackson [EMAIL PROTECTED] Date: Wed, 21 Jul 2004 14:12:24 -0400 Subject: Re: UDF within a Custom Tag To: CF-Talk [EMAIL PROTECTED] On Wed, 21 Jul 2004 13:29:40 -0400, in cf-talk you wrote: What about using isCustomFunction() or isFunction from http://cflib.org/udf.cfm?ID

Re: UDF within a Custom Tag

2004-07-21 Thread Brook Davies
NOT isCustomFunction(doTocOption) cfscript function doTocOption(myQuery, contextFilePrefix) { ... } /cfscript /cfif Qasim - Original Message - From: Jamie Jackson [EMAIL PROTECTED] Date: Wed, 21 Jul 2004 14:12:24 -0400 Subject: Re: UDF within a Custom Tag To: CF-Talk [EMAIL PROTECTED] On Wed, 21 Jul

Re: UDF within a Custom Tag

2004-07-21 Thread Claude Schneegans
I just tried your suggestion, and it behaved the same as if I didn't I encountered the same problem once and no suggestion was able to get around the problem. It looks like the function is compiled twice, no matter any CFIF you may put aroud it, even CFIF thisTag.execution mode, nothing. --

Re: UDF within a Custom Tag

2004-07-21 Thread Claude Schneegans
You can also just do isdefined('doTocOption') to see if the function has been created. No matter what you test in the CFIF, even CFIF false, the function will be compiled, once on start, and once on end. IMO It is definitely a bug. -- ___ REUSE CODE! Use

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 15:39:05 -0400, in cf-talk you wrote: Shouldn't you be doing this? cfif NOT isFunction(doTocOption) cfscript function doTocOption(myQuery, contextFilePrefix) { ... } /cfscript /cfif Yes, sorry, just a typo in the post, but not in my experiment. [Todays Threads] [This

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 12:43:39 -0700, in cf-talk you wrote: You can also just do isdefined('doTocOption') to see if the function has been created. Normally, maybe; however, not within the context of a Custom Tag (it just doesn't work). :-/ Thanks, Jamie [Todays Threads] [This Message]

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 15:53:27 -0400, in cf-talk you wrote: I just tried your suggestion, and it behaved the same as if I didn't I encountered the same problem once and no suggestion was able to get around the problem. It looks like the function is compiled twice, no matter any CFIF you may put

Re: UDF within a Custom Tag

2004-07-21 Thread Raymond Camden
Jamie - If you are on CF5 you only have 2 choices really... Use the request scope. You would define the UDF in the request BEFORE you call the custom tag. Ie, Application.cfm may cfinclude a file of UDFs where each UDF is copied to the request scope. You would call the UDF in the CT by using

Re: UDF within a Custom Tag

2004-07-21 Thread Jamie Jackson
On Wed, 21 Jul 2004 15:39:19 -0500, in cf-talk you wrote: Jamie - If you are on CF5 you only have 2 choices really... Use the request scope. You would define the UDF in the request BEFORE you call the custom tag. Ie, Application.cfm may cfinclude a file of UDFs where each UDF is copied to the

Re: UDF within a Custom Tag

2004-07-21 Thread Raymond Camden
It is definitely a bug. It was fixed in either 6.0 or 6.1. And thank goodness it was. :) -Ray On Wed, 21 Jul 2004 17:23:32 -0400, Jamie Jackson [EMAIL PROTECTED] wrote: On Wed, 21 Jul 2004 15:39:19 -0500, in cf-talk you wrote: Jamie - If you are on CF5 you only have 2 choices really...