Fckeditor & php: HTML header is gone?

Fckeditor is something that I’ve used for home and work often. It is a lightweight, very adaptable open-source wysiwyg editor. The editor can be used with most major web languages (php, js, coldfusion, etc..).

Recently I ran into a problem that I have not seen before (and this could be due to the complexity of the site I was working on, being too complex for its own good:)).

I had an existing site built mainly in PHP, and wanted to add the ability for the site’s owner to edit the pages using Fckeditor.

After uploading the Fckeditor, the _samples directory had mostly working PHP examples. However, each time I would edit a file, the html and head section would just disappear.

Hitting the “source” button on Fckeditor, revealed that it did not see the or other sections of my code.

After quite a bit of googling, I discovered that I needed to enable full page edits with this fckconfig.js addtion:
FCKConfig.FullPage = true;

In addtion, since some of the files had php code in them, I needed to add:
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code

While I can understand Fckeditor “hiding” html head sections and things like server-side php code, given that it is supposed to be a wysiwyg editor for non-programmers, the major problem is that is LOSES that data.

Fine, if you want to, by default, hide much of the source code of a file, at least do not lose it upon post.

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Fckeditor & php: HTML header is gone?

  1. Bill Lindley says:

    Could it be that you were referring to Zen Cart as “too complex for it’s own good”?

    I have been trying to make this work on a Zen Cart site. I have a link in the right sidebox called Price that is a price list I only want users to see if they are logged in. I am trying to wrap the price list in an EZ page.

    I’ve tried including the code (the “price” link) and I tried entering the code into the html area for the ez page.

    I installed the fckeditor, but I’m not really sure if it’s working correctly. I made the changes in the file you suggested, but no luck.

    I posted to the Zen Cart forum here http://www.zen-cart.com/forum/showthread.php?t=37252&page=5 if you’re just a little bit curious and have a minute to give some advice.


  2. Jason says:

    I wasn’t referring to Zen Cart, it was some sites that my team developed that are not commercial.

    I took a look into your issues with Zen Cart and Fckeditor, and your issues did not seem to be similar to mine.

Leave a Reply

Your email address will not be published. Required fields are marked *