用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3719|回复: 5
收起左侧

fckeditor 的路径使用问题,求助

[复制链接]
发表于 2009-5-25 09:39:43 | 显示全部楼层 |阅读模式
我没有使用fckeditor自带的图片上传,一是因为不能使用绝对路径,因为使用绝对路径一旦把内容从一个位置转移到另一个位置,里面的路径就都错了,另一个是我需要加水印。
   所以采用自己写文件上传,然后把地址设置到内容中,可是还是有问题,因为使用的是相对地址,这样在fckedit中地址会成为http://localhost/jtmuseum/application/plugins/fckeditor/editor/upload/images/qq65.jpg,而内容浏览时,地址需要另一个地址,也就是说两个相对地址的基地址是不一样的。
请问这种情况怎么处理呢?
发表于 2009-5-25 10:11:09 | 显示全部楼层
fckeditor里面图片代码写成 <img src='/upload/images/qq65.jpg'/>
发表于 2009-5-25 10:13:48 | 显示全部楼层
使用 JS 的方式装载 fck。然后在装载 fck 的 js 上使用绝对路径。用 PHP 代码生成此 js 代码即可。
 楼主| 发表于 2009-5-25 11:21:22 | 显示全部楼层
使用 JS 的方式装载 fck。然后在装载 fck 的 js 上使用绝对路径。用 PHP 代码生成此 js 代码即可。
Hex 发表于 2009-5-25 10:13


刚才试过了,和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>
 楼主| 发表于 2009-5-25 11:23:37 | 显示全部楼层
fckeditor里面图片代码写成
duxins 发表于 2009-5-25 10:11


这样写还是使用的绝对路径啊,比如我现在使用的base_url路径是http://domainname/test/
一旦换到
http://domainname/下,文章中的图片地址就都不对了。
发表于 2009-5-25 12:56:09 | 显示全部楼层
请一定使用绝对路径,不要在 CI 里使用相对路径。
这是一条准则。

本版积分规则