CFEclipse 1.3 Update – Part II

Posted: February 19, 2007 in ColdFusion

Hello World,

In my last post I talked about two of the several new features of the CFEclipse 1.3 update. One of which was the Code Snippets feature. Although the Code Snippets has been a feature of CFEclipse for some time now most people (including myself) are either unaware of its existance or its features. I would like to revisit the Code Snippets in this post. I admit that I did not give Code Snippets the credit that it deserved. After playing around with the Code Snippets panel for more than 15 minutes I found that it has a bit more to it than one might think at first glance. So let’s look a little beyond the first glance and explore a couple of the coolest features of the Code Snippets panel.

1) User Variables: One of the coolest features I found while using the Code Snippets was the use of variables in your snippets. You can define variables within your code snippet. Your variables can be defined as shown below:


Here is an example of how you would use the variable definition:

<cfquery name="$${queryname}" datasource="cfdocexamples">

Now when you double click on your Code Snippet in order to place it into your code, a dialog box will be displayed prompting you for a value for the queryname variable. You can define more than one variable within your code snippet. See below:

<cfquery name="$${queryname}"
cachedwithin="#CreateTimeSpan($${days}, $${hours}, $${minutes}, $${seconds})#">

Using this code snippet, the dialog box will prompt you for the queryname, days, hours, minutes, and seconds.

2) System Snippet Variables: In addition to being able to use your own variables you can also use the following System Snippet Variables:

$${DATE} - Enters the date as MM/DD/YYYY E.g. 11/30/2007
$${MONTH} - Enters the month as text E.g. February
$${TIME} - Enters the time E.g.: 7:29:58 AM
$${DATETIME} - Enters the date and time E.g.: 2/9/2007 7:29:58 AM
$${DAYOFWEEK} - E.g.: Friday
$${CURRENTFILE} - Current file name (just the file)
$${CURRENTFOLDER} - Current folder (The path to the containing folder)
$${CURRENTPATH} - Current path (full file name)
$${CURRENTPRJPATH} - Just the folder
$${USERNAME} - Current user
$${MONTHNUMBER} - Month as a number
$${DAYOFMONTH} - Day of month as a number
$${DAYOFWEEKNUMBER} - Day of week (the week starts on Sunday)
$${DATETIME24} - DateTime24 - a 24 hour clock version of datetime.
$${YEAR} - Current year.
$${YEAR2DIGIT} - Current two digit year.

Here is an example of you might use one of the System Variables:


As you can see this is a sample fusedoc that uses a couple of the System variables to automatically substitute the current file and the current date. A user variable is defined which will prompt for the responsibilities text.

CFEclipse TV

The site has added a new section called <a href=””>CFEclipse TV</a>. This section hosts several screencasts describing some of the features of CFEclipse including Using Snippets for Speedy Coding and Getting Started.


  1. Mark Drew says:

    Also, you should note that you can put default values too, as well as a drop down of values, for example:

    Hope that helps!

  2. therush says:

    Mark – You are correct. I wanted to keep this blog simple. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s