Content Management with ColdFusion

As the Web develops, the need for easy and efficient Web site and portal management increases.

Developing an easy-to-use future-proof content management system (CMS) from scratch isn't easy. The basic functionalities can be assembled in a reasonable timeframe, meaning that you will be able to edit the structure and the content of the Web site. An enterprise CMS with complex features like scheduled content publishing, content replication, cluster support, sophisticated workflows, roles, and other advanced features can take several years.

In this article I'll explain the purpose of a CMS and its benefits. Then I'll describe the content lifecycle and how ColdFusion can be used in every phase. In the last section I'll provide links to helpful (mostly Open Source) ColdFusion projects that can be integrated into a CMS.

What a Content Management System Is and Why You Should Use One
A content management system delivers functionalities to empower non-technical staff to create new pages on a site and produce and modify existing content.

After the set-up and configuration process, which in many cases still has to be done by technical staff, a product manager can update the information on a new product release without any programming skills, HR managers can publish new job offers, and the PR manager can put press releases on the Web site. Web site templates and structured content classes assure that the company's corporate Web site design will always be maintained.

A flexible CMS allows the comprehensive control and management of digital content by integrating different content types (e.g., text, images, Flash, video, sound, etc.).

One of the most important features of an up-to-date CMS is a comprehensive security system including rights, roles, and groups (see Figure 1). So each Web site team member can participate in the publishing process to the degree desired, permissions such as to create, edit, change, delete, or publish content have to be easily assigned. If there are more than 10 editors you'll find it helpful to assign bundles of rights to roles and assign these roles to the editors. Typical roles are "author" "editor," "translator," and "editor-in-chief." If several sites must be maintained like an intranet, a corporate Web site, and different country Web sites, groups will help to assign the editors to the sites they're entitled to work on. For maximum flexibility it should be possible to assign arbitrary combinations of groups and roles to an editor: a person can be an author for the international Web site and an editor with more permissions for the country Web site.

Workflows help to define processes, e.g., new or changed content has to be reviewed before publishing. The CMS should inform the editor-in-chief via e-mail or an integrated notification system when an article has been finished and has to be approved. Powerful workflow systems can publish an approved article automatically or the article will revert back to the author with comments about changes.

Content management systems help companies efficiently create and maintain intranets, portals, and other Web sites. They structure and speed up the publishing process and guarantee compliance with corporate design. Last but not least, a CMS reduces Web site publishing costs in a significant way, considering that employees can easily provide and publish content and avoid the expense of Web agencies making simple content changes.

Phases of the Content Management Lifecycle
Most CMS experts describe the four phases of content management (see Figure 2) as:

  1. Content creation, editing, integration of external content
  2. Quality assurance and approval
  3. Publishing and content delivery
  4. Versioning and archiving
The first phase includes content creation, editing existing content, and integrating external content through syndication (e.g., sports or stock exchange news). It also means aggregating content, categorizing it (for target groups, personalization, etc.), and defining the metadata for optimized content retrieval. To achieve a high acceptance by editors, content creation has to be simple and accurate: functions like WYSIWYG, preview, libraries, form-based-entry, and direct edit help integrate the content fast and comfortably.

To avoid typos and unwanted information on the Web site, workflows can help create the approval process (the second phase). Sophisticated workflow systems can set up a simple four-eye principle that can be started manually, as well as predefined actions and complex processes that start automatically or periodically. In a workflow several tasks can be approved and forwarded to the next step or rejected to the author. Content repositories or libraries store the content managed and should deliver functions for editors to enable easy retrieval and reuse of captured content. The API defined in the Java specification JSR170 helps access content in a vendor- or implementation-neutral fashion. It contains several content services such as the versioning and query service.

Publishing and content delivery constitute the third phase of the content lifecycle. Publishing is the preparation of content for different target groups and channels (e.g., HTML, print, PDA output), generating files, and distributing them to different servers. Content delivery means serving static, dynamic, or hybrid pages to Web site visitors. Static pages provide highest performance but only dynamic pages allow personalized content. The choice of publishing static or dynamic pages should depend on the content, not the CMS technology.

Versioning and archiving is the fourth and last step in the content lifecycle. Changes to published content have to be saved and should be restorable with minimal effort. If content has been deleted by mistake or typos have been overlooked, rollback functions should reactivate former versions of the content in a few clicks.

Over seven major revisions ColdFusion has empowered many developers to rapidly build powerful Internet and Web applications. High-performance and scalable CMS software can and has already been built using it. In the next sections I'll show you how ColdFusion can be used to create a CMS covering every phase of the CMS lifecycle.

Using ColdFusion in the Content Creation Phase Acquisition
ColdFusion has built-in tags for HTTP support like CFHTTP, CFHeader, and CFContent.

CFHTTP can be used to retrieve data from another page or site. You can also have ColdFusion automatically save the files to the server when it gets the information back from the URL.

The conversion and import of external data (like Microsoft Office data or XML data) is possible through COM objects. For all kinds of COM questions cfComet is a good resource.

Dave Raggett's HTML TIDY is a free utility to fix HTML mistakes automatically and tidy up sloppy editing into nicely laid-out markup. Tidy can also be configured for HTML code saved from Microsoft Word.

Greg Steward wrote the ColdFusion function makexHTMLValid, which takes a string and URL as arguments and uses jTidy to parse and validate the XHTML.

Aggregation
Incoming syndication feeds (like RSS or Atom feeds) can be retrieved using CFHTTP. The ColdFusion XMLParse function can be used to parse the document. This is also a validating parser, so it will choke if you pass invalid XML.

The CFXML tag is used to create an XML document that will later be converted to a string and written to a file. This lets you create an RSS feed for your site.

ColdFusion has built-in support for Web Services and provides a function (CreateObject) and a tag (CFINVOKE) for Web Service consumption. It's easy to integrate external data using Web Services even if they're developed in other languages.

Authoring
Some CMS Web-based text editors are very feature-rich and almost content management tools in themselves. Others are essentially plug-ins that act as form fields. Some are free and some are extremely expensive. The FCKeditor (see Figure 3) is one of the most popular and with good reason: it's free Open Source (LGPL, Closed Distribution Licence), easy to customize, and it works very well. On the server side, FCKeditor offers a complete integration pack for ColdFusion.

XStandard is another standards-compliant WYSIWYG plug-in editor for desktop applications and browser-based content management systems. The editor generates clean XHTML Strict or 1.1, uses CSS for formatting, and ensures the clean separation of content from presentation. Ben Nadel programmed a ColdFusion version of the XStandard Web Service.

CFFM is a cfml-based media asset repository manager intended for integration into existing Web site management solutions. It's for uploading, creating, renaming, deleting, and editing of files and directories.

The ASF File Explorer is a file manager to browse, add, and remove directories and files from a specific server location. It was built using CFForms and Flash remoting.

Using ColdFusion in the Quality Assurance and Approval Phase
Workflow
An appealing Workflow GUI could easily be built using Flash or Flex. Workflow messaging, e-mail, or SMS notifications can be realized with CFMAIL and the SMS Event Gateway.


Spellchecker
Content quality can be ensured by including a spellchecker module. Some WYSIWYG editors like FCKeditor come with integrated spellcheckers like ieSpell and Speller Pages.

An interesting article on the ColdFusion Developer's Journal Web site, explaining how to use the Open Sourced Jazzy Spell Checker with ColdFusion MX can be found at http://cfdj.sys-con.com/read/42120.htm.

Localization
rbMan is a cfmx app used for managing Java resource bundles. It can be integrated into other apps or run as a standalone Web-based editor. The beauty of it being Web-based is that your translators can work on a live app from anywhere around the world without having to install any third-party software.

Reporting and Charting
Powerful integrated business reporting capabilities were added to ColdFusion MX 7. The Flex product family includes Flex Charting 2 (a set of charting components).

Using ColdFusion in the Publishing and Content Delivery Phase
Publishing and Distribution
CMS pages can be distributed to the live server using several protocols. CFFTP or the CFSFTP CFC let you transfer files using ftp or the secure sftp protocol.

Syndication
The CFXML tag provides the functionality to create RDF and RSS syndicated news feeds for your or your customer's Web site. This tag creates an XML document that can be converted to a string and written to a file.

You can make any of your ColdFusion components available to any system over the Internet by publishing it as a Web Service. ColdFusion makes this extremely easy to do. In fact, you only have to add one attribute (access="remote") to any of your component's methods to turn it into a Web Service.

Search and Locate
ColdFusion includes the Verity search engine that lets you index and search documents, databases, and existing Verity collections.

Using ColdFusion in the Versioning and Archiving Phase
Storage
JDBC enables ColdFusion MX 7 to interact with a variety of database management systems.

Reactor is an object-relational modeling tool that generates database abstractions on-the-fly as needed, creating an object-oriented database abstraction layer. Objects are regenerated as your database or configuration file changes.

Mark Mandel's Transfer framework automates the repetitive tasks of creating the SQL and custom CFCs that are often required when developing a ColdFusion application. Through a central configuration file Transfer knows how to generate objects and manage them and their relationships back to the database.

A good way to handle SQL trees and hierarchies is the nested set model. Barney Boisvert's TreeManager CFC manages a tree of records in a database table using this model.

Versioning
Rick Osborne's Java SVN browser is a nice example of how you can connect to a Subversion repository. Rick has also created CFDiff. It's intended to provide similar functionality to that provided by the classic Unix diff utility.

Conclusion
This article has been an introductory guide to Content Management with ColdFusion. I've walked through all the phases of the CMS lifecycle and showed you how ColdFusion and Open Source software based on ColdFusion can help you to develop a basic CMS. This was not meant to be an extensive overview of all facets of a CMS, but should provide you with some ideas and links to interesting ColdFusion projects.

Resources
http://cfdj.sys-con.com/read/42120.htm - Spellchecker article
http://cfopen.org/projects/cfm - ColdFusion File Manager
http://cfregex.com/cfcomet - CFComet Web site
http://code.google.com/p/cfdiff - CFDiff project
http://gregs.tcias.co.uk/cold_fusion/cfmx_and_jtidy.cfm - jTidy blog article
http://rickosborne.org/blog/?p=86 - SVN browser
http://trac.reactorframework.com/reactor - Reactor framework
http://transfer.riaforge.org - Transfer framework
http://www.asfusion.com/projects/fileexplorer - AS Fusion File Explorer
http://www.barneyb.com/blog/archives/000532.jsp - Tree Manager
http://www.bennadel.com/blog/79-XStandard-ColdFusion-Web-Services-Solution.htm - XStandard Web Service
http://www.fckeditor.net - FCKeditor
http://xstandard.com - XStandard Editor

© 2008 SYS-CON Media