使用xheditor二次编辑内容时,内容不完整

一直以来,我的博客是没有重新编辑已发表文章功能的,今天终于更新了,主要是使用xheditor时有一些问题,这是我在xheditor论坛上的提问

我在使用xhEditor时遇到了一个问题,我是把它用在我的独立博客上的,但是我发现,编写后提交的文章,再次编辑会出现问题,比如我写了一篇文章 ,比较短,编辑后源码如下span style=font-family: Tahoma, Arial; /spandiv class=commentbox-content style=padding-top: 3px; padding-right: 3px; padding-bottom: 14px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(255, 255, 255); padding-left: 15px; br /还是linux 好用/div但是再次编辑时就变成了div class=commentbox-content style=padding-top: 3px; padding-right: 3px; padding-bottom: 14px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(255, 255, 255); padding-left: 15px; br /还是linux 好用/divquot; gt;如果是p你好啊,/ppstrong测试一下/strong/p就什么也没有了总的来说,提交后再次从数据库读取,会1.前面少了很多字符2.后面会自动出现quot; gt;我二次编辑是从数据库读取后对textarea的value进行设置查看数据库发现保存的内容是完整、正常的  "
<""><>
<"""">
<>

<>


<"""">
<>

<>
&&


<>


<>
<>

<><>
<>






&&


此时查看编辑页面源文件发现内容完整,但是显示出来的却有问题,请问这是怎么回事?

收到的回答:

无论是否用可视化编辑器,重新编辑,必需要对数据库中的值进行转义,再放入textarea内。
就是说,你要保证<textarea>和</textarea>之间不出现任何的HTML代码,也就是不允许出现<和>两个符号。
得到回答后,我又看了下源码,我是通过value=""赋值的,更改为直接写在<textarea>和</textarea>之间,然后对从数据库读取内容进行转义 editpost.content = web.htmlquote(editpost.content),然后就一切正常了。
再次赞一下xhEditor官方论坛的管理员,总是一语道破玄机,对于我们免费用户也热心指点。

1,687 views, since 2011-06-26