Is there a way to test for the first call of a function?

Hello

I created a function (using other functions I created) to generate a dynamic hierarchy tree menu based on parentID and itemID etc etc - I'm sure you are familiar with this concept. It works very well, and there is no problem.

However, I do all this build in a string, and then dumped on the page. Again, this works very well. However, because the function is called recursively, my class, the class = 'tree' repeat itself in each occurrence of the opening UL tag.

I want to only this class to be applied to the first UL, but because it is recursive, I don't know how to detect if the function is called for the first time or 5th time, etc.. I mean something like:

< cfif myFunction is called the first time >
Add the class
< cfelse >
do not add the class
< / cfif >

Please see my attached code. It is fully functional. Please don't worry that all the other functions do etc, they work very well, but I need a way or a variable to test against.

Any ideas?

Thank you very much
Michael.

Kapitaine wrote:
> Hmmm, I bet that the solution is simple, but my mind is frazzled! Haha.
>

Yes, it's simple, you test the Boolean value and it will be true if it is
set to true for a recursion.






#somethingStupid(5,true) #.

Tags: ColdFusion

Similar Questions

Maybe you are looking for

  • I can't save new bookmarks or delete existing ones.

    My bookmark system worked until a few days ago and now will not let me save new pages or delete existing ones. Tried both methods described on the main site, neither worked.

  • Measures of reliability does not

    Hello Recently, I get an error message: measures of reliability does not. This message is repeated every half hour on my Vista and started last week. The solution gives to think that I have installed the latest updates I did. The problem is not yet s

  • 8460p: keep the smart card reader attached, even if the card is removed

    HP EliteBook 8460p Win 7 Pro 64-bit When a smart card is inserted, you are able to see your smart card reader in Device Manager. When you remove your card chip, the chip card reader disappears in Device Manager. Is it possible to always keep the smar

  • What will I do to install the Arabic language in my computer

    Original title: Hello Sir IAM using windows vista home basic and I lost the language Arabic but Arabic in my computer, I tried to add the language that is not in the list of languages and I tried to download the language of microsoft, but I think I'v

  • Impossible to install the latest version of Flash Player on Mac (OS 10.9.5)

    Asked me to install the latest version of Flash Player on my Mac (OS 10.9.5). First of all, everything went as usual: I downloaded a disk image, called "AdobeFlashPlayer_22au_a_install.dmg", and when I click on that I get a "Adobe Flash Player Instal