Cannot add PHP Scripts into FCKeditor

2 replies
Hi,

I have FCKeditor version 2.6.4.1Build 23187 and I'd like to embed php scripts into my text content when I create that text via FCKeditor. (Although my template page is .php, I still want to be able to add PHP scripts via FCKeditor)

The problem is when I click the 'Source' button and add any php script, FCKeditor automatically strips that code and removes it.

For example:
If I click 'Source', then add the following: <?php echo $Test?> and then click the 'Source' button again to go back to normal text view, and then click 'Source' again, I get...

<!--p echo $Tes-->

I know very basic PHP, so is there a 'trick' or an easy way to 'force' FCKeditor to accept my PHP scripts?

I spent hours on this on the Web and couldn't find a solution!

Thanks.
#add #fckeditor #php #scripts
  • Profile picture of the author zardon
    I don't think this is possible without a plugin. I'm aware in FCKEditor you can edit the config file to change what defaults it uses, but I do not recall it allowing you raw access to PHP codes.

    The best way to do is to separate your logic from your content. Your FCKEdited content should not contain raw PHP code at all and you should try to seperate it as much as possible, or use Placeholders like the old SMARTY templates and then parse it with your PHP files; this is much harder and will take a lot longer to do though.
    {{ DiscussionBoard.errors[5008785].message }}
  • Profile picture of the author Milito25
    The problem is I need those PHP scripts INSIDE my content and this can't be done without using FCKeditor. There must be an 'elegant' way out for this.
    {{ DiscussionBoard.errors[5012396].message }}

Trending Topics