iT邦幫忙

0

關於 php 嵌入 fckedit 無法呼叫的問題

請問我想在php裡面放入fckeditor,但是我的顯示表格是整個$set變數,之後會把他帶到 html 裡面 , 問題是 如果 $oFCKeditor->Create(); 放在 $set 以外就可以正常顯示 但是如果放到 $set 裡面就會出不來,想請教該如何處理呢
<?php
include("../fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor('n_content');
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Value = $row['n_content'];
$oFCKeditor->Width = '750';
$oFCKeditor->Height = '600';
$oFCKeditor->Config['SkinPath'] = 'skins/default/';
$oFCKeditor->ToolbarSet = 'Default';
$oFCKeditor->Create();

$set = "

<br>
<div align=\"center\">
<table border=\"1\" width=\"60%\" id=\"table6\" cellspacing=\"0\" style=\"border-collapse: collapse\" height=\"110\">
<tr>
<td width=\"100%\">

<!------- 放入這裡顯示失敗 $oFCKeditor->Create(); ----->

</td>
</tr>

<tr>
<td colspan=\"2\" bgcolor=\"#FAE29A\">
<p align=\"center\"><input type=\"button\" value=\"送出\" onclick=\"do_sub('".$st."','".$gge."');\"></td>
</tr>
</table>
</div>
";
?>

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

6
wiseguy
iT邦超人 1 級 ‧ 2011-10-25 23:33:14

用 output buffer 把 FCKeditor 抓成字串塞進去就行了。

&lt;pre class="c" name="code">&lt;?php
ob_start(); /* 加上這行 */
include("../fckeditor/fckeditor.php");
:
$oFCKeditor->Create();
$FCK = ob_get_clean(); /* 加上這行 */

$set = "
:
$FCK
:
";
?>

我要發表回答

立即登入回答