WA AltClass Iterator function with ColdFusion Page
I just purchased DataAssist 2.0 and am running into this error when pages are uploaded to the server:
Error Diagnostic Information
Just in time compilation error
Invalid parser construct found on line 70 at position 10. ColdFusion was looking at the following text: WA_AltClassIteratorInvalid expression format. The usual cause is an error in the expression structure.
The last successfully parsed CFML construct was a CFSCRIPT tag occupying document position (68:1) to (68:10).
Server: IIS/5.0 + ColdFusion 4.5 (Yes, I know there is a version 9), but this is what they gave me.
This is the code created by WA:
<cfscript>
//WA AltClass Iterator
function WA_AltClassIterator(theArray,theStartIndex) {
if (Len(theArray) GT 1) {
if (Left(theArray, 1) EQ "|")
theArray = "WABLANKCLASS" & theArray;
if (Right(theArray, 1) EQ "|")
theArray = theArray & "WABLANKCLASS";
theArray = Replace(theArray, "||", "|WABLANKCLASS|");
}
else {
if (theArray EQ "|") {
theArray = "WABLANKCLASS|WABLANKCLASS";
}
}
theArray = ListToArray(theArray, "|");
tempStruct=StructNew();
StructInsert(tempStruct, "ClassArray", theArray);
StructInsert(tempStruct, "ClassCounter", theStartIndex);
return tempStruct;
}
function WA_AltClassIterator_getClass(loopObj, incrementClass) {
if (ArrayLen(loopObj.ClassArray) EQ 0)
return "";
if (incrementClass) {
if (loopObj.ClassCounter GT ArrayLen(loopObj.ClassArray))
loopObj.ClassCounter = 1;
loopObj.ClassCounter = loopObj.ClassCounter + 1;
}
retVal = "";
if (loopObj.ClassCounter GT 1)
retVal = loopObj.ClassArray[loopObj.ClassCounter-1];
else
retVal = loopObj.ClassArray[1];
if (retVal EQ "WABLANKCLASS") return "";
return retVal;
}
</cfscript>