将nicedit textarea内容保存到mysql数据库中 [英] Saving nicedit textarea content into mysql database

查看:402
本文介绍了将nicedit textarea内容保存到mysql数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新手,所以我很感谢一个很清楚的解释,提前感谢。

I'm sort of a newbie so I would appreciate a very clear explanation, thanks in advance.

我在网站上使用nicedit textarea,要读取的信息可以包含:

I'm using the nicedit textarea on a website, the information to be read could contain:


  • 只是纯文本(用户格式化)

  • Just plain text (user formatted)

文字和图片

我使用的是mysql资料库,知道如何以如下方式保存textarea的内容:

I'm using a mysql database and I don't know how to save the content of the textarea in a way that:


  • 可以从数据库中读取文本而不丢失用户格式

  • 文本区域中的图像可以存储到文件系统中,并在从数据库读取文本(并将图像放置在用户期望的位置)时重新加载。

我使用的是php,如果这是所需的信息。

I'm using php if that's needed information.

我希望有人能理解我

推荐答案

你不需要担心关于保存内容,因为NicEdit保存所有文本& HTML格式的样式。该HTML可以轻松地保存到数据库中的文本字段。
问题是,NicEdit不会将样式同步到原始文本区域,因此,当您提交表单时,内容保存时没有样式。

You do not need to worry about saving the content because NicEdit saves all text & styles in HTML format. That HTML can easily be saved into a Text field in your database. The problem is that NicEdit does not sync the styling into the original text area, So when you submit the form the content is saved without the styling.

解决这个问题,你需要明确要求NicEdit保存样式,然后通过添加这一行来提交表单:

To solve this, you need to explicitly ask NicEdit to save the styling before you submit the form by adding this line:

nicEditors.findEditor('<you_textarea_id>').saveContent();

这篇关于将nicedit textarea内容保存到mysql数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆