Shaun Mccran

My digital playground

04
M
A
Y
2010

How to stop FCK Editor wrapping your content with 'P' tags

Whilst testing a website for WCAG 2 Accessibility compliance I noticed that all my dynamic content from a database was wrapped in the HTML 'P' element.

The functionality that put the content into the database was a rich text area using the inbuilt FCK Editor. This article deals with how to stop FCK editor wrapping your content in undesirable tags.

[ More ]

29
A
P
R
2010

JQuery Datatables plugin example using a server side data request (coldfusion)

Im my previous article on how to use the JQuery datatables plug I concentrated mainly on the JQuery script, and how to build the AJAX request to receive a JSON response.

In this article I will demonstrate the full application which will include the front end JQuery, building the back end server response and a few tips that I've picked up since implementing the plugin. I am using an MS SQL table filled with UK location data that I also used for a weather webservice, to fill the table.

A full example of this working can be seen here: Data table server side example

[ More ]

16
A
P
R
2010

Adding fck Rich Text Editor to your Coldfusion forms & customising the Toolbar set

Whilst writing a Content Management System (CMS) recently I thought I'd take the time to go over some Coldfusion 8 functionality that passed me by when it was released.

In Coldfusion 8 the fck editor was included as part of the server installation. This article deals with integrating it into your forms, and how to build a custom tool bar set to manage the options displayed with it.

[ More ]

25
M
A
R
2010

Pre loading object (CFC) references in your Application.cfc

One of the best practices that I've been using more and more is ColdFusion's ability to add CFC object references to scopes. By this I mean that it is possible to create a shorter friendlier scoped variable that you use to reference your CFC's.

In your Application.cfc you can map out all your CFC references, this gives you a much shorter variable name to type each time, and it caches the CFC.

view plain print about
1<cffunction name="onApplicationStart">
2
3<!--- scope out all the objects as application level vars --->
4<cfset application.formObj= createObject('component','dir.objName ')>
5<cfset application.siteObj= createObject('component','dir.objName')>
6<cfset application.mailObj= createObject('component','dir.objName')>
7<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>
8
9</cffunction>

Put any references like this in the 'onApplicationStart' function. You do not need to lock the scope in this function, and if the code within it does not run successfully then it does not continue running the application. It will try again on the next page request.

The caching functionality here is great, not only will Coldfusion create a handy short name for CFC, but it will actually run through the code, and stop on any errors. If you deliberately introduce a code error into one of your objects you will see the Application halt and show you the error. For me this is reason enough to move all my business logic into CFC's. This essentially means that it is not possible for a user to get part of the way through a application and find an object based error.

Using this in conjunction with a framework such as FuseBox allows you to load, parse and cache the CFC object, all before your actual display layer has been invoked.

The example below uses the FuseBox function 'onFuseboxApplicationStart' of starting an Application.

view plain print about
1<cffunction name="onFuseboxApplicationStart">
2    <cfset super.onFuseboxApplicationStart() />
3<!--- scope out all the objects as application level vars --->
4
5<cfset application.formObj= createObject('component','dir.objName ')>
6<cfset application.siteObj= createObject('component','dir.objName')>
7<cfset application.mailObj= createObject('component','dir.objName')>
8<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>
9
10
11</cffunction>

Changing the 'fusebox_parameters.mode' value allows you to set this caching at an environmental level, so no caching for development, or caching for live

view plain print about
1<cfset FUSEBOX_PARAMETERS.mode = "development-full-load">
2Or
3<cfset FUSEBOX_PARAMETERS.mode = "production">

_UNKNOWNTRANSLATION_ /