I've been having so much trouble with getting FCKeditor to honor relative paths in images and links. I've written a PHP script that lets me edit any of my site files with FCKeditor, but it's having problems.
My FCK editor directory is in /FCKeditor/. My files are in the site root (/) (public_html). It didn't make sense for me to move my site to the FCKeditor directory, so I've been trying to have fck editor "reach down" to my site root edit the files.
FCKeditor would leave my relative image paths alone but display them as broken in the editor window. My first hack was to write "put_dots_in" and "take_dots_out" functions which would put ../../ into every relative link and image in the HTML before handing it to the editor, and then take them out after the FCKeditor was done before writing to a file. This worked, and images would properly display in the editor since they were properly referenced from FCKeditor's root (which seems to be FCKeditor/editor), but I ran into a nasty bug of FCKeditor interpreting relative links as absolute links and trying to add http://address.com/http://address.com/relative_link into my relative links a lot of time.
Since that was buggy, I disabled the put_dots_in functions and tried to get the file browser to work, figuring if I could point FCKeditor to the directory I wanted to link to or referance an image to maybe it would help it or me learn what it thinks its pointing to. I've tried the PHP default and mcpuk connectors with a lot of struggle.
Am I correct that FCKeditor hard codes the directories where your images can go, with the directories File, Image, Media, and Flash? This makes things more secure I guess (somehow it can access directories outside /FCKeditor/ even though I have safe mode on), but doesn't make much sense if I'm trying to edit a site with a directory structure already laid out. However, making my UserFiles path "/" and changing my site images directory to /Image and rewriting all of my HTML code on the site did seem to work. Interestingly my relative links have to look like "/Image/something.gif", which is strange; "Image/something.gif" won't work, and no other UserFiles paths (such as "." or "") seem to work.
Is there some way to make the FCKeditor more flexible for working on a preexisting site? I've chmodded 777 my whole site hoping I could get the link manager out of the File directory so that you could browse the rest of the site properly, but I can't get it to work. I've found that generally my PHP scripts like to work better on my server with chmod 755 and owner/group Apache, but FCKeditor likes chmod 777 and owner/group the virtual site admin # that it is also under.
Lastly, every once in a while I find that FCKeditor randomly majorly truncates my HTML files and ruins the whole page. I think it's FCKeditor but it could be a bug on my server or my PHP script. I wrote a bug tracker (anonymously, oops) about it here. http://sourceforge.net/tracker/index.ph ... tid=543653
Thanks,
Jordan
Mon, 08/01/2005 - 10:09
#1