>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 hadn't thought of; however, it doesn't
seem to work:
The following gives the same error I've had all along:
<cfif NOT isDefined("request.doTocOptionIsDeclared")>
<cfscript>
function doTocOption(myQuery, contextFilePrefix) {
...
}
request.doTocOptionIsDeclared = true;
</cfscript>
</cfif>
The error associated with the above is:
"Routines cannot be declared more than once.
The routine doTocOption has been declared twice in different
templates."
Furthermore, within cfscript blocks, function declarations seem to be
disallowed within conditionals, so the following also doesn't work:
<cfscript>
if (NOT isDefined("request.doTocOptionIsDeclared")) {
function doTocOption(myQuery, contextFilePrefix) {
...
}
request.doTocOptionIsDeclared = true;
}
</cfscript>
The above yields:
"Just in time compilation error
Invalid parser construct found on line 220 at position 3. ColdFusion
was looking at the following text:
function
Invalid _expression_ format. The usual cause is an error in the
_expression_ structure."
Lame :(
Thanks,
Jamie
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

