Twitter: raymondcamden

Address: Lafayette, LA, USA

Using Project Templates in ColdFusion Builder 3

05-05-2014 3,414 views ColdFusion 11 Comments

One of the interesting new features in ColdFusion Builder is the new project template system. This lets you create a project with files automatically laid out. Unfortunately, the docs only discuss the mobile version of this (i.e., what you see when you make a new mobile project). If you do not plan on building cfclient projects (ahem), then you may think this feature doesn't apply to you. Luckily, that isn't the case at all.

You can easily create templates for "regular" projects as well. To do so, first find your ColdFusion Builder install and open the templates folder. There is a chance you may only see one subdirectory: mobile. That's all I had. But if you go to create a new project, the editor will quickly lay out a new subdirectory, server. I don't think you even have to create the project completely, just start the process. To me, this is a bit of a bug, the folder should be there anyway, but just keep in mind you may or may not see it. If you don't see it, I recommend doing what I did - start the new project creation process.

Under server will be two more folders: system, and user. System will be empty. User is where you will create your templates. Template creation is a bit awkward. You don't just create a template. Rather you create a group of templates. So for example, I may have a group called "HTML Unicorn" for all my different front-end heavy applications. I may have another group just for Frameworks, where I have a template for FW/1, Model-Glue, ColdBox, etc.

To define your group, just create a subdirectory under system/user. I called mine Mine. Yes, I did. You then need to create a text file called config.xml. This will define both the group and enumerate the different templates. Here is the one I built.

<template name="Ray's Templates">
		These are my templates. There are many like it, but these are mine.
		<type value="Blank">
				A blank template with no damn index.cfm
		<type value="Framework One">
				Framework One (v2.2) becuz it is teh awesome.

As you can see, I've got a top level description for my group. It doesn't really matter what you put here unless you plan on sharing with others. Then I have two types. The first, Blank, is just that, a blank template. CFB uses the value "Blank" as the directory to look into for source code. So in my case, I've got a subdirectory called Blank. I then have a second one for Framework One. I downloaded the bits and copied the skeleton application into it.

That's really all there is to it. Just remember that the value in the XML field has to match the folder name. I originally used "Framework/One" for the value and realized that would probably make CFB have a fit. Here is my template showing up in the new project UI:

And here is the project it laid out - nicely laid out with FW/1 files.

I just realized that the FW/1 skeleton does not actually copy the FW/1 CFC. I'm assuming the idea is that it relies on a server-wide mapping for it. I'm going to copy it into my template now so I don't have to worry about it.

Finally, I should point out that - technically - this has been possible for some time now. Since CFB2, you could write an extension that tied to the project UI and did the exact same thing this does. Actually a heck of a lot more. You could write custom code to seed a project, initialize values, ring some cowbell, and go crazy. If you want something simpler though this is a real nice option.


These comments will soon be imported into Disqus. To add a comment, use Disqus above.
  • Chris Galli #
    Commented on 05-08-2014 at 11:43 AM
    Thanks. I just got through writing an extension in CFBuilder 2 that does basically this. I was wondering though, if you know, how I can get the username information into an extension. I was able to use $${USERNAME} in my snippets, but don't see that available for extensions.
  • Commented on 05-08-2014 at 1:16 PM
    If it isn't passed to the extension, then I don't know. Remember you can dump form.ideEventInfo to see what is there.
  • Commented on 09-04-2014 at 5:05 PM
    Thanks for your practical and very useful suggestons. Could you post some help on using the new with subsystems when you have time?
  • Commented on 09-04-2014 at 5:10 PM
    I haven't done FW/1 subsystems yet. I've done a few small FW/1 apps, and I love it, but I'm just a beginner user.
  • Commented on 09-22-2014 at 5:34 PM
    I'm not sure what is wrong. I copied qBall into wwwroot. Created a "virgin" qball database (MySQL), as described in your blog. But I get the error:
    Exception occured before FW/1 was initialized
    It must implement interface cfide.orm.IEventHandler (Application)
    Exception - click to expand - struct
    Detail   It must implement interface cfide.orm.IEventHandler
    Message   model.beans.eventHandler is not a valid ORM event handler.

    Any suggestions?
    Tom Keller
  • VolumeOne #
    Commented on 09-23-2014 at 6:02 AM
    I was hoping for a template system like Dreamweaver where I can ensure that every new page I create has elements already included such as the Header and Footer.

    Is it possible to have type of template in CF Builder?
  • Commented on 09-23-2014 at 10:30 AM
    Use Snippets. Makes it super easy.
  • Commented on 09-23-2014 at 12:43 PM
    @Thomas: Um, I don't know. I haven't used qBall in forever.
  • Michael A Williams #
    Commented on 11-06-2014 at 5:51 PM
    Ray, are you using CFB 3? I find it impossible to use. The FTP/SYNC/RDS is obfuscated to the point that I can't even set up a simple site.

    I'm going to have to go to DW6 since I can't seem to even find a place to purchase CFB 2 which while difficult to set up at least could be set up for FTP/RDS/SYNC.

    What is going on with Adobe. It's like they are trying to make it difficult to use these products on purpose.
  • Commented on 11-06-2014 at 6:27 PM
    I don't use FTP/RDS for remote editing as I try to avoid editing on a live server as much as possible. What exactly is the issue with it? I opened up RDS File View and it just plain worked. Did you have trouble finding it?
  • Michael A Williams #
    Commented on 11-06-2014 at 6:49 PM
    My systems are too large for desktop editing. (very large databases and millions of image/asset files). I use a set of development servers. I do use local file CFM/CFC editing with FTP on save.

    I just put in RDS as another example of settings that were easy to set up in CFB 2 but difficult in CFB 3. I don't use RDS and it's off even on my dev servers for security concerns.

    In DW4-6 you can just set up an FTP connection and have the IDE auto upload on save. Easy to set up and works every time.

    Even in CFB 2 you can open files from FTP and save to FTP which is not the best but at least it works. It's right on the file menu and is simple to set up.

    In CFB 3 you cannot open a file from FTP and setting up a sync is a convoluted, undocumented process that simply does not work well if it works at all. Getting it sort of wset up involves setting up a Team Sync in another Perspective and then you might be able to get the view from that perspective to show up in the CF perspective. Even if you do, you have to take the extra step to sync your changes to the server every time which is hit or miss.

    The Adobe forums have the same complaints concerning the remote dev process with no resolutions.

    Also the tag editor is gone or at least any method to get to it is so well hidden it should be declared leagly dead. In CFB 2, it was a simple icon on the CFML toolbar (if you can call half a dozen buttons a toolbar. Tag insight is not as simple to me as a tag editor.

    All in all, I'm just tired after hours of trying to get this stuff to work and a little angry at the difficulty of using the IDE. Homesite and Dreamweaver were never this difficult. It's seems silly.

    Thanks for the response. You are a real asset to the CF community.