<input type="hidden" id="body" name="body" value="" style="display:none" /><input type="hidden" id="body___Config" value="FullPage=false" style="display:none" /><iframe id="body___Frame" src="/include/FCKeditor/editor/fckeditor.html?InstanceName=body&amp;Toolbar=Basic" width="100%" height="450" frameborder="0" scrolling="no"></iframe>我现在是要编辑文章。所以会从数据库返回一个字符串,我把字符串赋给了变量$body。现在要将它设定到编辑器中,请问怎么操作。 

解决方案 »

  1.   

    <?php
    $id = 'id1';
    $name = 'name1';
    $content = 'content1';
    $width = '100%';
    $height = '320px';$string = '<!-- 编辑器调用开始 -->
    <script type="text/javascript" src="./Js/FCKeditor/fckeditor.js"></script>
    <textarea id="'.$id.'" name="'.$name.'">'.$content.'</textarea>
    <script type="text/javascript">
     var oFCKeditor = new FCKeditor( "'.$id.'","'.$width.'","'.$height.'" ) ;
      oFCKeditor.BasePath = "./Js/FCKeditor/" ;
       oFCKeditor.ReplaceTextarea() ;
       function resetEditor(){setContents("'.$id.'",document.getElementById("'.$id.'").value)};
        function saveEditor(){document.getElementById("'.$id.'").value = getContents("'.$id.'");}
         function InsertHTML(html){ var oEditor = FCKeditorAPI.GetInstance("'.$id.'") ;
         if (oEditor.EditMode == FCK_EDITMODE_WYSIWYG ){oEditor.InsertHtml(html) ;}
         else alert( "FCK必须处于WYSIWYG模式!" ) ;}</script> <!-- 编辑器调用结束 -->';
    echo $string;
    ?>
      

  2.   

    请问我下面这样的写法那里错了呢?下面是出现的错误提示
    Parse error: syntax error, unexpected '=' in D:\PHPnow1.45\htdocs\kumocms\admin\fck.php on line 3
    -------------------------------------------------------------<?php
    include_once('./FCKeditor/fckeditor.php');
    FCKeditor=new FCKeditor('myFCKeditor');
    FCKeditor->BasePath='./FCKeditor/';
    FCkeditor->ToolbarSet='Default';
    FCKeditor->Width='100%';
    FCKeditor->Height='500px';
    FCKeditor->Value=$body;
    FCkeditor->Create();
    ?>
      

  3.   

    请高手们帮帮我呀,我学PHP不久,搞了很久都不行