Tequila Fish Ran-dumb ramblings of me…

12Sep/083

FCKEditor: Remove & prevent <p> tags from wrapping your content.

For some reason, FCKEditor automatically wraps any content entered into the textbox with a <p> tag. This can cause for some problems in your layout when you're actually displaying the content. Instead of trying to fix this in your layout with CSS, there is a quick and easy way to turn the auto-wrap off in FCKEditor: Change the FCKConfig.EnterMode setting from 'p' to 'br'. There are a few ways to handle this:

  • Edit fckconfig.js:
    Change FCKConfig.EnterMode = 'p'; to FCKConfig.EnterMode = 'br';
  • Change the setting programatically when you instantiate the object, like so (in PHP):
    <?php
    include_once('fckeditor/fckeditor.php');
    $oFCKeditor = new FCKeditor('description');
    $oFCKeditor->BasePath = '/fckeditor/';
    $oFCKeditor->Value = 'some text';
    $oFCKeditor->Config['EnterMode'] = 'br'; // turn off auto <p> tags wrapping content
    $oFCKeditor->Create();
    ?>

I prefer the latter way because you can do it on a page by page basis, and there's no messing with FCK's core JavaScript files.

Comments (3) Trackbacks (0)
  1. Excellent tip for replacing with

    no need to change any .js file

    really worth …’

  2. $oFCKeditor->Config['EnterMode'] = `br`; // turn off auto tags wrapping content

    tyldę tam trzeba dać `br`
    u góry jest bład , a tylda działa :)


Leave a comment


No trackbacks yet.