I'm using FCKEditor v2.6, and need to open file from the disk, containing HTML and (or) PHP code, edit content, and save back this file. For this task i'm using this code:
i'm trying to open with next content:
but after opening i see next source in FCKEditor:
if (!file_exists($file) || !is_readable($file)) {
$fh = fopen($file,'w+');
fclose($fh);
} else {
$fh = fopen($file,'r');
$cnt = fread($fh,filesize($file));
fclose($fh);
}
$P_CNT.='
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor(\'content\');
oFCKeditor.BasePath = \'/fckeditor/\';
oFCKeditor.ToolbarSet = \'EditPage\';
oFCKeditor.Height = \'300\';
oFCKeditor.ReplaceTextarea() ;
}</script>
<textarea name="content" rows="10" cols="80" style="width: 100%; height: 200px">'.$cnt.'</textarea>';i'm trying to open with next content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Title</title>
<meta name="robots"content="noindex,nofollow">
<style type="text/css">
body a:link, a:visited { color: #06f }
body a:hover, a:active { color: #c00 }
</style>
</head>
<body>
<p>text</p>
<?
echo 'test message';
?>
</body>
</html>but after opening i see next source in FCKEditor:
<p></p>
<p>
<meta content="noindex,nofollow" name="robots" /><style type="text/css">
body a:link, a:visited { color: #06f }
body a:hover, a:active { color: #c00 }</style></p>
<p>text</p>
<!--
echo 'test message';
-->
Re: Is it possible to edit file, containing HTML and (or) PHP co
FCKConfig.ProtectedSource.Add( /<[\s\S]*?>/g ) ;
and edit this line:
FCKConfig.EnterMode = 'br' ;
now left another problem, source file contains:
<style type="text/css"> body a:link, a:visited { color: #06f } body a:hover, a:active { color: #c00 } </style>in visual mode FCKEditor shows code inside <style> tag... how to fix it ?