Note: This blog post is from 2011. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.A client of mine asked if I might know how he could setup ColdFusion Builder 2 so that when he opened an htm file with it, it opened with its ColdFusion editor. He's one of those folks who've configured their environment so that htm pages are processed by CF so they can have CFML code in them. (More on that notion, the pros and cons, in a moment.)
The solution for getting CFB to open an HTM file in the CF editor is not too hard, but since he was thrown off a bit by some things he saw (when I suggested simply that the answer was in Builder's Preferences>General>Editors>File Associations page), I offered the specific steps. I then decided to go ahead and blog it, since I don't find anyone else having done so (feel free to comment if someone did).
Note that this solution applies as well to CFBuilder 1.
About having CF process htm files (the server, not the editor)Before I proceed to explain the editor setup, I'm sure some reading this will want to stop and either ask about or warn against(!) this idea of someone setting up their server to have htm files processed by CF.
It's one of those things that have either delighted or appalled people over the years.
I don't want to get into the discussion here, but it's a worthwhile one, so I will offer that in a follow-up entry-- yes, including how to do it if you want to, and yet also why some would say you should think twice (and how you might address their concerns.) Update: here's the link to that follow-up blog entry.
Hey, I'm just a consultant. I let you know your options, and trust that you're adults who can decide for yourselves. :-)
How to configure CFBuilder to edit HTM files with the CFML editor
So, assuming you do want to do edit HTM files with the CFML editor, here's how you do it, step by step (following this image):
- Go to Preferences>General>Editors>File Associations (the preferences menu is under CFB's "Window" menu on Windows, and under the "Adobe ColdFusion Builder" menu on Mac)
- Select "*.htm" in the upper "file types" pane
- In the *lower* pane ("Associated editors"), click "Add"
- Choose the "Internal editors" radio button
- Choose "Adobe CFML editor" and click "ok"
- On returning to the previous "File Associations" page, in that lower pane, now select that "Adobe CFML Editor" option which now appears, and click the "default" button (assuming you want it to be the default opener of htm files)
It's that simple. Note that these changes do not require a restart of CFB to take effect.
I'll add that if you don't make this the new default editor for htm files (the last step above), you can still find it listed as an option for editing an htm file, by right-clicking that file in the navigator and choosing "open with". The context-menu dialogue will now list "Adobe CFML Editor" as an option--indeed it will be first in the list, since that context menu lists editors in alpha order.
That's it. Let me know if the steps above may have helped you, or if you may some comments/corrections.
Some other points
Before concluding, the customer shared a couple of other related thoughts, when he thought this couldn't work and he was explaining why he might go with another editor. I addressed them as well, so I thought I'd share them here as well.
First, he didn't like that with CFBuilder you "have to create a file before hand", meaning when you create a new file, it asks you to give it a name and location within a project.
Actually, you don't HAVE to do that in CFB, at least for HTM files and some other extensions (though NOT cfm files). There's an option that many miss. Take a look at File>New>Other>Untitled Files. Since he would now have setup CFB to process htm files as CFM files, this could indeed work for him. I address that feature (and others) in my "Hidden Gems in CFBuilder" talks, both for CFB1 and for CFB2.
Second, he expressed concern about the price of CFB, noting that the alternative he was considering (Coda, for OS X, which does have CFML support) cost only $99. The implication was that CFB is more expensive.
I pointed out to him that (as many still don't know) there is in fact a free version of CFB. Yep, if you don't buy it within the 60-day trial, it then reverts to the free "Express" edition. That does remove some functionality, but plenty remains. More here, among other places . Just want to be clear on that. :-)
For more content like this:
Need more help with problems?
- Signup to get my blog posts by email:
- Follow my blog RSS feed
- View the rest of my blog posts
- View my blog posts on the Adobe CF portal
- If you may prefer direct help, rather than digging around here/elsewhere or via comments, I can help via my consulting services
- See that for more on how I can help a) over the web, safely and securely, b) usually very quickly, c) teaching you as we go, and d) with satisfaction guaranteed