I’ve had several projects in the past few months which have called for some limited content management capabilities. In cases like these, where only small sections of the site need to be handled by an administrator, it seems silly to build the entire site on top of existing CMS platforms like Joomla or Drupal. The problem is, if you build a small administration area, you’ll have to have some mechanism for specifying simple HTML content for the non-tech savvy.
A co-worker recommended FCKeditor, so I implemented it in a recent administration interface to control text for a few pages. So far it’s worked extremely well, and was a breeze to implement. Here’s a summary of my implementation:
- Downloaded, unzipped, and stored the FCKeditor files
- Created a custom editor style file (myeditorstyles.css), and put the site’s content styling rules in it so the editor would mimic the site’s style
- Created a custom configuration file (myconfig-default.js), which serves to remove a bunch of the unnecessary functionality, and reference the style:
FCKConfig.FontFormats = 'h1;h2;h3;p';
FCKConfig.ToolbarCanCollapse = false;
FCKConfig.EditorAreaCSS = '/lib/includes/FCKeditor/myeditorstyles.css';
FCKConfig.ToolbarSets["Default"] = [
['Save'],
['Undo','Redo'],
['Bold','Italic','Underline'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink'],
['FontFormat'],
['About', 'Source']
];
- Included the initialization files on the pages I put the editor:
<?php
include_once("[myeditorpath]/fckeditor.php") ;
?>
- Then referenced the editor where I wanted to add it in my code:
$oFCKeditor = new FCKeditor([myeditorid]);
$oFCKeditor->BasePath = '/[myeditorpath]/';
$oFCKeditor->Config["CustomConfigurationsPath"] = "/[myeditorpath]/myconfig-default.js";
$oFCKeditor->Height = '500';
$oFCKeditor->Create();
That’s it! There’s a ton of other customization options, help with implementation, and general resources in the documentation.
Other Options
I highly recommend FCKeditor, but if it doesn’t work for some reason you can always try TinyMCE or openwysiwyg. Both seem full-featured and easy to implement, and both have significant recent activity.
If you think content won’t require any additional HTML formatting, you could always just programmatically replace line breaks in text areas with HTML line breaks and vice versa. This would allow the administrator to use carriage returns to separate text, but would require some HTML knowledge for additional formatting.
Update (8/22/2008): Evaluated Cross-Domain AJAX with DOMAssistant.
AJAX applications have become commonplace, but many of the tutorials for developing them lean heavily on the help of JavaScript frameworks like DOMAssistant or Prototype. So I figured I would take a look at the standard AJAX-related properties and methods, see how cross-domain calls make the whole process slightly more complicated, and find out how much the frameworks can actually help. Without the help of a framework, you basically have three steps to display content obtained via AJAX: