This is a quick note on using the cfmodule tag in Coldfusion. Personally, I don’t use this tag. However, I was working on an application built on the Fusebox framework. The application essentially uses the cfmodule tag to call certain fuse action templates. I was writing a new action and, following suit implemented, the call to the action via the cfmodule tag. Running the application I noticed that the content executed by the action was duplicated.
So I began plugging in some logging to determine where the duplication was beginning and try to narrow it down. I noticed essentially that my action was being executed twice, but still no idea why. When coding I have a tendency to always close out any CF tags that do not have a closing tag. So for example I write cfset tags as
<cfset variables.myVar = "" />
Notice the closing ‘/>’.
Well, I now know that you shouldn’t do this with the cfmodule tag. The reason is because it is a wrapping tag. If it does not have a closing tag it will execute the template parameter. So let’s say I have two files: ‘index.cfm’ and ‘content.cfm’. Let’s look at index.cfm.
At Monserrate Monastery in Bogotá, Colombia.