i've added a textarea control in my PHP page, using the CKEditor's class.
Now if the textarea loads empty, CKEditor works. But if i try to load a PHP variable in the textarea, the page show correctly the editor, but it won't show the content (and the editor appears to be blocked).
Here's my code:
<div id="dialog-edit" title="Edit" style="display: none;">
<table cellspacing="10">
<tr>
<td>
<table>
<form method="post" name="form">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
<br/>
<textarea class="ckeditor" name="html" id="html" style="width: 766px; height: 390px; margin-left: 6px;"><?php echo htmlentities($html) ?></textarea><br/>
<input type="submit" name="save" id="save" value="Salva modifiche" class="button" />
</form>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
function showDialogEdit()
{
$( "#dialog-edit" ).dialog({
width: 680,
height: 620,
modal: true,
open: function(event, ui)
{
}
});
}
</script>
The textarea must show the content (saved in a MySQL database as an HTML code), into the textarea, but it isn't doing this.
What's making this issue?
Thanks.
Try following the "replace by code" example in the CKEditor demo folder instead:
http://jsfiddle.net/mblase75/g2HFn/4/
$("#dialog-edit").dialog({
width: 680,
height: 620,
modal: true,
open: function (event, ui) {
CKEDITOR.replace('html');
}
});
Write in config file of ckeditor (config.js)
CKEDITOR.editorConfig = function( config ) {
/* ALLOW <?php ... ?> tags */
config.protectedSource.push(/<\?[\s\S]*?\?>/g);
config.extraAllowedContent = 'style';
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With