CKEditor value set when html tags used
My question is in regards to setting the value of a CKEditor. I am able to set the value when its simple text, but when the text has html tags in the value is unable to set.
Maybe there is a question similar already in existence.
CKEDITOR.instances.contentTexto.setData( '<?php echo $var_myRow['contents']; ?>' );
Ok so I have figured out how to remove the html tags simply by this:
$var_contentString = $var_myRow['contents']; $var_contents = strip_tags($var_contentString); echo $var_contents;
And it works! Now when I send my variable to setData(''); like this it still shows nothing. Whats happeing here, can someone explain this a little?
Also when I check the pageSource the data seems to be coming through with the tags in the setData(); function. So its purely a display issue CKEditor has with html tags.
try this :
CKEDITOR.instances.contentTexto.setData('<?php echo str_replace(array("'"),array("\\\'"),$var_myRow['contents']); ?>');