duanbage2161 2014-04-24 07:06
浏览 55
已采纳

如何在DIV内显示回声内容

I am attempting to load an html file for inline editing with tinymce by basically echoing the output into a div area so the editor takes over. The page loads just fine, however the editor appears "above" the html page in what looks like a small div box that spans the page instead of the content. What I need is the echo'd $contents to appear inside of the div area and instead it seems to be appearing below it.

screenshot added

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="../tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "div.edit",
theme: "modern",
plugins: [
    ["advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker"],
    ["searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking"],
    ["save table contextmenu directionality emoticons template paste"]
    ["fullpage"]
],
add_unload_trigger: false,
schema: "html5",
inline: true,
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image     | print preview media",
statusbar: false
});

tinymce.init({
selector: "h1.edit",
theme: "modern",
add_unload_trigger: false,
schema: "html5",
inline: true,
toolbar: "undo redo",
statusbar: false
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>

<div class="edit"><?php 
$filename = "../projectevo/emeraldcity.html";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);

echo $contents;

?></div>
</body>
</html>
  • 写回答

1条回答 默认 最新

  • drjltlm156790 2014-04-24 07:29
    关注

    You better use the Text area mode and it will work well.

    <textarea name="" cols="" rows="100">
    <?php 
    $filename = "../projectevo/emeraldcity.html";
    $handle = fopen($filename, "r");
    $contents = fread($handle, filesize($filename));
    fclose($handle);
    echo $contents;
    ?>
    </textarea>
    

    I have used this method and it works perfectly.

    It should render something like this. And you could directly type to the table enter image description here

    And initialize like below

    tinyMCE.init({
        // General options
        mode : "textareas",
    

    Instead of your

    selector: "div.edit",
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大