【已解决】smarty中php调用FCKeditor无法显示在指定div容器?

#1 小双

这个写在general.php里面
public function createEditor($inputName, $inputValue = '', $width, $height, $toolbarSet){
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;

$oFCKeditor = new FCKeditor($inputName) ;
$oFCKeditor->Width = $width ;
$oFCKeditor->Height = $height ;
$oFCKeditor->BasePath = $sBasePath ;
if ($_GET['toolbar'] == $toolbarSet) {
$oFCKeditor->ToolbarSet = $toolbarSet;
}
$oFCKeditor->Value = '' ;
$oFCKeditor->Create() ;
}


 

下面是在public function display中调用:

public function display($tplname, $output = TRUE)
{
// 编辑器
$this->FCKeditor = $this->createEditor('FCKeditor1','',380,300,Basic);}


模板页面里面是:
<{$FCKeditor}>


显示是显示,不要模板页面里<{$FCKeditor1}>,也会显示,不管怎么弄都是显示在页面最顶端,无法显示在我指定的div容器里?

=======================================================
问题已解决,需要php版fckedit编辑器的可以下载,上面是我整合sp以后的代码:
fckeditor.rar
注意:下载该文件以后,请阅读3楼的修改意见!要不然你会发现你修改fckconfig.js文件不会有任何变化的!

2010-06-07 18:49:33

#2 jake

$oFCKeditor->Create() ;
改成

return $oFCKeditor->CreateHtml() ;

好像是CreateHtml还是哪个,看看说明吧。Create是直接显示了,有个函数是返回代码的。

2010-06-07 21:34:26

#3 小双

好了,就是用的这个“return $oFCKeditor->CreateHtml() ;”。谢谢!

2010-06-08 09:17:54

#4 小双

上面的附件里面要修改general.php里面要加这句:
$oFCKeditor->Config['CustomConfigurationsPath'] = '/fckconfig.js' ;
才可以加载fckconfig.js的设置。
而且每次修改fckconfig.js后要重新打开编辑器页面才可以看到效果,估计是缓存的原因。

public function createEditor($inputName, $inputValue = '', $width, $height, $otoolbarSet){
                $sBasePath = $_SERVER['PHP_SELF'] ;
                $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
               
                $oFCKeditor = new FCKeditor($inputName) ;
                $oFCKeditor->Config['CustomConfigurationsPath'] = '/fckconfig.js' ;
                $oFCKeditor->Width =  $width ;
                $oFCKeditor->Height = $height ;
                $oFCKeditor->BasePath        = $sBasePath ;
                //if ($_GET['toolbar'] == 'Basic') {
                $oFCKeditor->ToolbarSet = $otoolbarSet;
                //}
                $oFCKeditor->Value                = '' ;
                //$oFCKeditor->Create() ;
                return $oFCKeditor->CreateHtml();
        }

2010-06-08 13:13:31

#5 vsxp

不错,拿来使用。

2010-06-11 16:00:08

#6 yuanjianhua

回复 4 小双


    为什么在我的项目中不能显示呢?

<div><input type="hidden" id="content" name="content" value="" style="display:none" /><input type="hidden" id="content___Config" value="CustomConfigurationsPath=/fckconfig.js" style="display:none" /><iframe id="content___Frame" src="D:\wamp\www\CBD/plug/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Default" width="100%" height="300px" frameborder="no" scrolling="no">iframe>div>

已经生成了,但是就是显示不出来,那是为什么呢?

2010-07-01 23:25:34

#7 jake

D:\wamp\www\CBD/plug/fckeditor/editor/fckeditor.html

路径没配好

2010-07-01 23:30:16

#8 yuanjianhua

可以了,解决了

2010-07-01 23:57:05