无法从Tiny MCE编辑器中的数据库加载文本

时间:2009-12-10 11:27:53

标签: 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,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>

<textarea name="program" cols="40" rows="12" class="contact_fields mceAdvanced"><?php echo( htmlentities( $row_this_trip['program'] ) ); ?></textarea>

我找不到这个错误。你能帮我吗?

2 个答案:

答案 0 :(得分:1)

你的html链接到TinyMCE脚本吗?

<script src="linktoscript.js" type="text/javascript" />

答案 1 :(得分:-1)

tinyMCE有一个triggerSave事件。

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;
         }
      });