i am displaying content in ckeditor textarea from the database. my content is stored in content variable and it is multiline.
code:
editor.setData(' < ?php
echo nl2br($content); ?>');
it gives error unterminated string literal!
EDITED:
code posted in comment:
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
var editor;
CKEDITOR.on( 'instanceReady', function( ev ) {
editor = ev.editor;
});
$('#custype').click(function(){
editor.setData('<?php echo $content;?>');
});
</script>
Perhaps you have leave a space between < and ?php that's why it is giving you error.
Use this:
editor.setData('<?php echo nl2br($content);?>');
You can try with this
var taxt_content = '<?php echo nl2br($content);?>';
editor.setData(taxt_content);
My solution is here:
var test = '<?php echo trim($girl['andesc_Content_Cs']); ?>';
CKEDITOR.instances.inputTextareaOne.setData(test);
php function trim is BEST !!!