Php 无法从微型MCE编辑器中的数据库加载文本
我正在我的网站上使用微型mce编辑器,我想从使用tinymce的文本区域的数据库中加载一些文本 编辑器的javascript配置如下所示:Php 无法从微型MCE编辑器中的数据库加载文本,php,database,tinymce,echo,Php,Database,Tinymce,Echo,我正在我的网站上使用微型mce编辑器,我想从使用tinymce的文本区域的数据库中加载一些文本 编辑器的javascript配置如下所示: <script type="text/javascript"> tinyMCE.init({ mode : "textareas", theme : "advanced", editor_selector : "mceAdvanced", plugins : "style,table,iespell,preview
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
editor_selector : "mceAdvanced",
plugins : "style,table,iespell,preview,directionality,inlinepopups",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,link,unlink,image,code,|,forecolor",
theme_advanced_buttons3 : "tablecontrols",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
// Example content CSS (should be your site CSS)
content_css : "css/example.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
这就是我试图在textarea中加载文本的方式:
<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced"><? php echo $row_this_trip['program']; ?></textarea>
此外,以下各项均不起作用:
<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced">Lorem Ipsum</textarea>
或
我找不出这有什么不对。你能帮我吗?你的html中有TinyMCE脚本的链接吗
<script src="linktoscript.js" type="text/javascript" />
有一个triggerSave事件
比如说,
tinymce.triggerSave();
$.ajax({
type: 'post',
url: 'autoSaveReport.php',
data: $('form').serialize(),
success: function (result) {
var redirectURL = window.location.pathname;
var redirectURL1 = redirectURL+"?incid="+result;
window.location = window.location+"?incid="+result;
}
});
我现在不能用谷歌搜索它,但是除了预先设置文本区域外,大多数富编辑器都有一个专门的JavaScript函数将数据加载到编辑器中。您应该在文档中找到,这可能会有所帮助。我们使用TinyMCE,可以在textarea标记之间回显内容,他的代码应该可以工作。您能确认textarea中确实有一些输出吗?您是否收到任何Javascript错误消息?你可以发布你初始化文本区域的代码吗?我已经搜索了维基和mce的文档,但没有找到任何解决方案。这就是为什么我认为我的代码一定有问题。我确信echo$row\u this\u trip['program']命令包含文本,因为如果我将它放在页面中的任何其他位置,文本都是可见的。但是当我把它放在textarea里面时,它就不工作了。是的,当然,除了我不能在其中加载文本之外,编辑器工作正常。我还发现这个问题只出现在firefox浏览器中。使用所有其他浏览器,一切正常。这很奇怪。
tinymce.triggerSave();
tinymce.triggerSave();
$.ajax({
type: 'post',
url: 'autoSaveReport.php',
data: $('form').serialize(),
success: function (result) {
var redirectURL = window.location.pathname;
var redirectURL1 = redirectURL+"?incid="+result;
window.location = window.location+"?incid="+result;
}
});