alanwilliamson

A few OpenBD goodies - catch all email and JQuery like Selector

I have just updated the nightly build of OpenBD to include a couple of goodies that will make the lives of the CFML developer just that little bit easier.

Outgoing Email catching

The first one is the ability to specify at the engine level that all outgoing email go to a given email box. This is extremely handy when it comes to developing mail heavy applications where you don't want to accidentally trigger an email to real users. The big advantage here is that you do not need to change any existing CFMAIL calls.

Instead, you specify one or more email address in the bluedragon.xml and then any CFMAIL call you make, emails will be redirected here instead. You can still observe which emails the email was originally intended by inspecting the mail headers: x-openbd-to, x-openbd-cc and x-openbd-bcc

More information here

JQuery style selection and manipulation

Let's be honest, one of the big reasons to be able to run Javascript on the server side is to be able to use the wonderful and powerful selection model of JQuery on your HTML content. Easily selecting one or more elements based on a hierarchy of class and tags makes getting at tags, attributes and content a pure joy.

This week, we introduced the new html() function which delivers this powerful selection/manipulation ability using the popular JSoup library.

As you can see from the CFML snippet, it is extremely powerful. Here we list all the anchor tags from the main OpenBD website.

<cfscript>
doc = html( FileRead("http://www.openbd.org/") );
 
allLinks = doc.select("a[href]");
for ( x = 1; x <= ArrayLen(allLinks); x++ ){
  WriteOutput("<li>" & allLinks[x].attr("href") & "</li>" );
}
</cfscript>

There is more you can do than just select, you can also change, insert and remove content. The JSoup library has modelled the full JQuery selection/manipulation library.

We've integrated the library into OpenBD so you can easily leverage all the functionality without any hassle. This is available as part of the core distribution.

More information here

more coming...

We've been working on bringing the upcoming v2.0 release to a close. We're working on a couple of outstanding issues and then that will be us. If you can't wait, then pull down the nightly release and take it for a run. We are already using it in production environments.

http://www.openbd.org/


 

Recent Cloud posts

Recent JAVA posts

Latest CFML posts


 
Site Links