CF Debug Output, Model Glue Style
Model glue has a serious problem if you have the "Report Execution Times" checked in the debugging output. I wrote about this in my FAQU article entitled "Lessons Learned from my first Model Glue App."
The gist is that the Execution Time could, in many cases, dump out the view HTML code, which your browser then renders. Now you could have two (or more) elements with the same name. Are you dealing with JavaScript? Now it's broken. And don't even think about anything AJAX related.
What are we to do?
You could turn off "report execution times". That will solve the issue, although if you need the execution times for some reason you're in trouble.
You could use the cfsetting tag to turn off all debugging output. But, I like my debugging output because it gives me warm fuzzy feelings.
So, what's left? You could rewrite the ColdFusion debugging template to "htmlformat" the method arguments before displaying them to the page. Huh? What are you smoking, Jeff.
Absolutely nothing (Illegal). If you look at a directory inside your CF installation ( something like C:/CFusionMX7/wwwroot/WEB-INF/debug/ ) you'll find some unencrypted files entitled classic.cfm and dockable.cfm
"Classic and Dockable" you think to yourself. "Where have I heard those names before?" Launch up your ColdFusion administrator and load the "Debugging Settings" page. Classic and Dockable are the two types of debugging templates available in the CF Administrator.
Create a copy of one of them and rename it. I created a copy of classic.cfm and called it DotComItDebug.cfm. Reload the debugging setting page in the CF Administrator and you'll see a "DotComitDebug" option listed in the debug output list. CF allows you to create your own debugging templates. It's a rarely used feature of CF.
The two Model Glue methods that were causing me problems were SetOutput and AddRenderedView. To fix the Model Glue problem, I added this code block, starting at line 479 (roughly):
<cfif (ListLen(template,"|") GTE 2) and (trim(ListFirst(ListGetat(template,2,"|"),"(")) is "SetOutput" or
trim(ListFirst(ListGetat(template,2,"|"),"(")) is "addRenderedView" )>
<cfset templateOutput = ListFirst(template,"|") & ListFirst(ListGetat(template,2,"|"),"(") & "(" & htmleditformat(ListRest(ListGetat(template,2,"|"),"("))>
</cfif>
It looks nicer all properly formatted, trust me.
I also changed all references to 'template' in the following if statement to 'templateOutput'.
( While you're in there, feel free to change all the variable dumps to 'cfdump'. I did )
I haven't re-read the CF license yet, but the warning in the classic.cfm file seems to allude to the fact that redistribution of this code is bad. So, for now, you'll have to make the modifications yourself.
What do you think?




There are no comments for this entry.
[Add Comment]