Who needs functions or objects when you've got the cfinclude tag?
-
Yea, yea....I'll say it first: the real WTF is ColdFusion. The problem is that this former "developer" would have sucked at any language.
Basically, script B was getting included on every iteration of a certain loop (over a query) in Script A. Script B included 2 function definitions, and a bunch of procedural spaghetti-code. The procedural spaghetti code in script B needed to be re-used on every iteration of the loop in Script A, but CF didn't like the 2 function definitions on the 2nd iteration because they were already defined when the file was included on the 1st iteration. Unfortnately, script B is also included by many other pages too... At first, I tried a simple:
if( isDefined('function_identifier') )
{
function function_identifier
}
Which seems to work if the function is defined in the same file, but for whatever reason, didn't work when the function was defined in a previous include. I finally had to place the function definitiosn in their own file (we'll call it Script C). Script A included Script C *once*. I added some code in Script B to check the CGI.SCRIPTNAME variable. If Script B isn't being included by "Script A", then it will call Script C and define the functions. *SIGH*
I've seen plenty of code from this former developer like this. She never quite understood that <cfinclude> wasn't meant as a substitue for functions/objects as a method of reusing code.
-
thread moved to side bar
-
Sorry I posted in the wrong forum. Thanks for moving it.
-
Was this developer's name "Russ", "Russell" or some variant thereof, perchance?
-
@morbiuswilters said:
Was this developer's name "Russ", "Russell" or some variant thereof, perchance?
Maybe, if she was particularly hairy.