This is how I'm creating my page with the editor (also using php):
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = "/admin/htmlEditor/" ;
//oFCKeditor.ImageBrowserURL = oFCKeditor.BasePath + 'filemanager/browser/default/browser.html?Type=/&Connector=connectors/php/connector.php&ServerPath=/home/beasley6/html/images/' ;
oFCKeditor.Create() ;
</script>
If $content has "<javascript>" tags in it, the page breaks. I would like to be able to include javascript in the page content, but when I do it just breaks. What's another way that I can put values that has <javascript> tags into the editor.
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = "/admin/htmlEditor/" ;
oFCKeditor.Value = '<? echo ereg_replace("\r\n"," ",str_replace("'","\'",$content)) ?>' ;
oFCKeditor.BaseHref = '<?= $siteurl ?>' ;
//oFCKeditor.ImageBrowserURL = oFCKeditor.BasePath + 'filemanager/browser/default/browser.html?Type=/&Connector=connectors/php/connector.php&ServerPath=/home/beasley6/html/images/' ;
oFCKeditor.Create() ;
</script>
If $content has "<javascript>" tags in it, the page breaks. I would like to be able to include javascript in the page content, but when I do it just breaks. What's another way that I can put values that has <javascript> tags into the editor.
I'll answer my own question.
oFCKeditor.Value = '<? echo ereg_replace("\r\n"," ",str_replace("'","\'",$content)) ?>' ;
make sure to replace the last </script> part of the javascript before inserting with something that won't cause conflicts with the browser. This will do:
$replace = '/<\s*\/\s*script\s*>/i';
$content = preg_replace($replace,"</js>",$content);
FCKeditor will rewrite </js> to </script>
Woohoo!