ColdFusion 4 added support for sophisticated Custom Tags (tag pairs and nested tags), and the way a Custom Tag is called now varies based on the tag type – simple tags do all their processing at once, tag pairs do processing in various execution modes, and nested tags have to do much of their processing in End mode. Calling a tag incorrectly (for example, calling a simple tag as a tag pair, or calling a tag designed to be used in a pair as a simple tag) can create interesting problems including non-execution, double execution, and incorrect execution. The solution is to start every Custom Tag with a few tests – ThisTag.HasEndTag lets you know if a tag was called as a tag pair or not, and ThisTag.ExecutionMode reports the execution mode if called as a tag pair. By checking these variables before processing you can better control (and eliminate) unwanted behavior. (Applies to: ColdFusion 4 (or later))

Leave a Reply