Snippets - A plugin for FCKeditor

Overview

The snippets plugin allows you to give users of FCKeditor the ability to insert small blocks of predefined HTML code. It is similar to the Templates function of the editor.

Installation and Configuration

  1. Unzip the files into the plugins folder.
  2. Open the snippets.xml file and configure to your liking. (see below section)
  3. Upload the Snippets plugin directory
  4. Configure the editor to see the plugin. In your editor configuration file, add the line below:

    FCKConfig.Plugins.Add( 'snippets','en') ;

  5. Add the toolbar button to your preferred menu.

    FCKConfig.ToolbarSets[ "Default"] = [
    ['Source','DocProps','-','Save','NewPage','Preview','-','Templates','Snippets'],


  6. Save and upload your configuration file. If all goes well, you should see the Snippets icon Snippetson your toolbar.

Adding your own snippets

The format of the snippets XML file is almost exactly the same as the one the Templates feature. You can read about configuring HTML templates here. A basic overview is below. Make sure your HTML is enclosed between CDATA tags or the XML may become unreadable.

<?xml version="1.0" encoding="utf-8" ?>
 <Snippets>
  <Snippet title="Title of the snippet" image="name of preview image - optional">
   <Description>
     Detailed description of the snippet - optional
   </Description>
    <Html>
      <![CDATA[
       html content goes here
      ]]>
    </Html>
   </Snippet>
</Snippets>

Images should go in the images folder located in the snippets folder. Images are not mandatory but look nice! If you don't want an image, remove the entire image attribute.

To test your XML syntax, simply open the file in Internet Explorer. It will let you know if it's valid or not.

Questions

Questions and ideas go to greggp@pobox.com. I'll try answer as soon as possible.