CFLib 2008

This post is more than 2 years old.

So I've been talking about relaunching CFLib for over four years now, and I've finally gotten around to doing it. If you haven't visited CFLib today, take a quick peak.

So what's behind the change? First and foremost, I want to give credit to Justin Johnson. He not only did the design but provided me with simple templates to make my life easier. He also did all the jQuery work. So all credit really goes to him. With that said, let me talk abit about what I changed and why.

The main difference is that this version is a heck of a lot simpler than the old site. I wanted a design that focused on the UDFs and made it easier to get to the code. The site basically has three main pages: Home Page, Library Page, and UDF page. That's it (again, pretty much). You can also get the code for a UDF from the library page. I dropped all the other pages. There aren't comments anymore, but they have been disabled for quite sometime anyway. I also got rid of the user system completely. Again - the idea is that you can come in, get the UDF, and get out.

Behind the scenes I'm using Model-Glue 3, ColdSpring, and Transfer. It is completely stupid and irresponsible to use Alpha software for a production site. Make sure you get that. But that being said, I thought it would be really cool use MG3 and heck, it's my site, I'll be dumb if I want to. I really loved the "helpers" feature of Model-Glue 3. So for example, to generate my captcha random text, I did:

<cfset captcha = helpers.util.makeRandomString()>

To format required CF version into a nicer string, I did:


And so on. You get the idea. I also made heavy use of the beans feature. So my UDFController has this at top:

<cfcomponent output="false" extends="ModelGlue.gesture.controller.Controller" beans="UDFService,LibraryService,config">

And here is an example of where I use it:

<cffunction name="getLatestUDFs" output="false"> <cfargument name="event" /> <cfset arguments.event.setValue("latestudfs", beans.udfService.getLatestUDFs()) /> </cffunction>

I did not use the new SES URL feature as I had a bit of trouble generating my links. Instead I simply used IIRF, a free IIS-based URL rewriter. Locally I used Apache rewrite. I ran into one problem with my SES URLs. When I did a redirect from an event at a SES url, it wanted to go to index.cfm, not /index.cfm. I added this to ColdSpring.xml to fix it:

<property name="defaultTemplate"><value>/index.cfm</value></property>

Notice the / in front. Also, note that the old site let you use URLs like this:

Thew new site still supports that, but also lets you get even shorter with:

The code coloring is done using ColdFish. jQuery is used on the library page to both animate and load it in via Ajax.

Outside of that it's a pretty simple site. I was lazy and didn't bother doing an admin. I'll just use the old site's admin for now. I did run into some Transfer problems, but I'll blog about that later.

Lastly - you may remember that I had said I was considering supporting custom tags and CFCs. While I think there is some merit to that - I really wanted to keep things simple. So for now, it's just UDFs (all 1k of them).

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for HERE Technologies. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA