gosimple 发表于 2009-5-25 09:39:43

fckeditor 的路径使用问题,求助

我没有使用fckeditor自带的图片上传,一是因为不能使用绝对路径,因为使用绝对路径一旦把内容从一个位置转移到另一个位置,里面的路径就都错了,另一个是我需要加水印。
   所以采用自己写文件上传,然后把地址设置到内容中,可是还是有问题,因为使用的是相对地址,这样在fckedit中地址会成为http://localhost/jtmuseum/application/plugins/fckeditor/editor/upload/images/qq65.jpg,而内容浏览时,地址需要另一个地址,也就是说两个相对地址的基地址是不一样的。
请问这种情况怎么处理呢?

duxins 发表于 2009-5-25 10:11:09

fckeditor里面图片代码写成 <img src='/upload/images/qq65.jpg'/>

Hex 发表于 2009-5-25 10:13:48

使用 JS 的方式装载 fck。然后在装载 fck 的 js 上使用绝对路径。用 PHP 代码生成此 js 代码即可。

gosimple 发表于 2009-5-25 11:21:22

使用 JS 的方式装载 fck。然后在装载 fck 的 js 上使用绝对路径。用 PHP 代码生成此 js 代码即可。
Hex 发表于 2009-5-25 10:13 http://codeigniter.org.cn/forums/images/common/back.gif

刚才试过了,和iframe加载的方式是一样的。生成的javascript代码如下:

<script src="http://smartempo.vicp.net/jtmuseum/application/plugins/fckeditor/fckeditor.js" language="javascript" type="text/javascript"></script><script type="text/javascript">var oFCKeditor = new FCKeditor("large");oFCKeditor.BasePath="http://smartempo.vicp.net/jtmuseum/plugins/fckeditor/";oFCKeditor.Height=600;oFCKeditor.ToolbarSet="Default";oFCKeditor.Value="<p>房间是开发快乐撒加发看了撒加发了看见撒开了见了看法撒加看了gfdgd</p>";oFCKeditor.Create();</script>

gosimple 发表于 2009-5-25 11:23:37

fckeditor里面图片代码写成
duxins 发表于 2009-5-25 10:11 http://codeigniter.org.cn/forums/images/common/back.gif

这样写还是使用的绝对路径啊,比如我现在使用的base_url路径是http://domainname/test/
一旦换到
http://domainname/下,文章中的图片地址就都不对了。

Hex 发表于 2009-5-25 12:56:09

请一定使用绝对路径,不要在 CI 里使用相对路径。
这是一条准则。
页: [1]
查看完整版本: fckeditor 的路径使用问题,求助