我正在使用 this WYSWIG编辑器.此编辑器显示在引导模式上. form action="?php echo base_url('dashboard/submit_post'); ?" method="POST" role="form" enctype="multipart/form-data"div class="form-group" label for="post_title"Post
<form action="<?php echo base_url('dashboard/submit_post'); ?>" method="POST" role="form" enctype="multipart/form-data">
<div class="form-group">
<label for="post_title">Post Title</label>
<input type="text" class="form-control" id="post_title" name="post_title" placeholder="Enter a title">
</div>
<div class="form-group">
<label for="post_content">Post Content</label>
<textarea name="post_content" id="post_content" cols="30" rows="3" class="form-control wyswig-editor"></textarea>
</div>
这个函数submit_post是这样的.
public function submit_post()
{
$this->process_post();
}
private function process_post()
{
$clean_post_title = $this->input->post('post_title');
$clean_post_content = $this->input->post('post_content');
$data = array(
'post_title' => $clean_post_title,
'post_content' => $clean_post_content
);
print_r($data);
}
这样的输出是显示帖子标题但是帖子内容不显示.它没有显示任何价值.我知道这一定是因为WYSWIG编辑器所以我禁用了wyswig编辑器类,然后它工作正常.但是,有一件事我注意到,当我禁用了wyswig编辑器类并发布了“Hello”作为post_content值时,显示了它,然后我启用了wyswig编辑器并将值更改为“Hello2”,输出仍然显示为Hello .某种方式编辑器创建了自己的textarea,因此显示的值是原始textarea.请帮忙.
您正在使用的此编辑器不会自动将内容插入到text_field中,您必须通过以下javascript自行完成:$('#txtEditor').Editor("getText")
一般来说这是一个糟糕的设计,我建议您使用其他类似的bootstrap所见即所得的编辑器,
> bootstrap-wysiwyg
> bootstrap-wysihtml5
> Summernote
我个人在我的项目中使用summernote.
