Sunday, March 7, 2010

New OpenBD Goodies: SpellCheck Plugin and RenderInclude() Function

In addition to the CronPlugin there are a couple more additions to Open BlueDragon this weekend: a SpellCheck Plugin, and a RenderInclude() function.

As you might guess from the name, the SpellCheck Plugin allows you to check the spelling of text from within your CFML applications. It ships with an American English dictionary, but you can register your own dictionaries in either OpenOffice format, Mozilla XPI format, or use a simple array of words.

Usage couldn't be simpler:

textToCheck = "Pleze chek mi speling.";
results = SpellCheck(textToCheck, "english-us");

SpellCheck() takes the text to check and the dictionary (or multiple dictionaries) against which to check the text, and it returns an array of structs with these keys:

  • originalWord - the misspelled word
  • positionIndex - the position of the first character of the misspelled word in the string being checked
  • suggestedWords - an array of strings that are suggested corrections for the misspelled word
Very slick and easy way to add spellcheck capabilities to your CFML applications.

The RenderInclude() function is a CFSCRIPT version of the CFINCLUDE tag so you can include templates within CFSCRIPT and have the code in the included template be rendered and returned as a string.

renderedOutput = RenderInclude("/path/to/template.cfm");

All the new functionality that has been added to OpenBD in the past few months has been an incredible asset to my CFML development, and I'm really excited to see more and more plugins being created. Plugins are an easy and extremely powerful way to add new functionality to the OpenBD engine. Reminds me that I need to get back to work on my CFTWITTER plugin to finish that out!

1 comment:

Matthew Woodward said...

Forgot to mention that the SpellCheck Plugin should be available for download tomorrow.