现在我要在codeigniter中实现CKeditor。它有效,但是我遇到了一些问题。当我想输入某种形式并通过验证或从数据库中获取值时,标记元素html无法转换。
这是我在表单上的代码
<script src="//cdn.ckeditor.com/4.10.0/full-all/ckeditor.js"></script>
<body>
<?php
$data = array(
'name' => 'content',
'class' => 'textarea',
'value' => set_value('content', $blog['content']),
'rows' => '5',
'cols' => '10'
);
echo form_textarea($data);
?>
<script>
CKEDITOR.replace( 'content', {
toolbar: [
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
]
});
</script>
</body>
我想制作这样的内容
测试1
测试2
但它会这样返回
<p><strong>test 1</strong></p> <p><strong><em>test 2</em></strong></p> <h1><strong><em>test 3</em></strong></h1>
即使我从数据库中获得价值,我仍然会返回相同的值。我该如何翻译所有元素而无需显示代码?