0
不設置HTML數據我想使用的CKEditor與CakePHP的,我已經寫了一個幫手。問題是當我用CKeditor輸入一些換行符或添加複選框(或其他html元素)時,下次編輯內容時編輯器崩潰。火狐返回以下錯誤:CKEditor的 - 裏面的textarea
語法錯誤:未結束的字符串
和亮點}).setData("<p>test</p>
從以下部分:
<script type="text/javascript">CKEDITOR.replace('data[Template][body]',{
toolbar: '',
toolbarGroups: '',
width: 950,
height: 500
}).setData("<p>test</p>
<p> </p>
<p>test</p>");</script>
這裏是蛋糕助手代碼:
$code = "CKEDITOR.replace('{$id}',{
{$options['toolbar']},
{$options['toolbarGroups']},
width: {$options['width']},
height: {$options['height']}
}).setData('" . trim($value). "');";
return $this->Javascript->codeBlock($code);
任何幫助是極大的讚賞。
試試這個htmlspecialchar($值); –
@RohitKumarChoudhary試過了,不起作用。 – Auxiliary