I have held on for a long time using version 2.1 of FCKeditor mainly because I had the relative paths set via the previous integration of CFFM (ColdFusion File Manager). I really wanted to move up to the latest version (2.6.x) but for whatever reason it took me a while to understand (mainly due to lack of time) the new file manager and how it controls the directory look ups. After performing a few searches, in the forums and on the web, on how to setup virtual paths with the new FCKeditor I did not really find any obvious instructions on how to do this the way I needed it done. Not saying it didn't exist I just didn't notice anything that would address my specific need. Needless to say, I have now managed to get a solution working for me and figured I would post my experience and discovery to help other looking for a similar solution.
Here is my scenario:
I have developed a content management system in ColdFusion whereas I have one set of application code that manages multiple client sites for serving up both front and back end client content. Each client has their own content directory for storing site related files. Their content directory must be relative to their actual directory path. After a little trial and error here is what I manged to do...
Edit the config.cfm file. It is located at /fckeditor/editor/filemanager/connectors/cfm/config.cfm. I set my own variable that can pull the client's directory value I have stored in their respective database. For the sake of simplicity let's just set a static variable. So just before the <cfscript> tag (about line 24/25) I set the following:
Establish Path Variable
Again, you can have "/assets/UserFiles" be a query result that populates the path as it relates to each client. Just a NOTE: I just happen to prefix the UserFiles with "/assets" just because I have my editor do other things within the client's ASSET folder. You obviously can set this to whatever works for you.
Setting the Config.Enabled to equal 'true'
CHANGE FROM
CHANGE TO
Set the Config.UserFilesPath to equal "clientpath". This sets the relative path value.
CHANGE FROM
CHANGE TO
Set the absolute variable
Next is to set the absolute path that is on the server within Config.ServerPath. To do this we take our same relative path value and enclose it in ColdFusion's "expandpath" function. This enables CF to convert the relative path into an absolute path.
CHANGE FROM
CHANGE TO
After making the above settings I assumed that it would have solved my path problem but it didn't. When trying to browse the server directory it was taking me to "/assets/UserFiles/Image" instead of "/assets/UserFiles/". So where was "/Image" coming from? A little further down in the config.cfm file (about line 116) there is an "Image" section that will have to be changed so the paths are pulled and inserted correctly.
CHANGE FROM
CHANGE TO
As you can see I had to remove the "& 'image/' " parts from Config.FileTypesPath and Config.FileTypesAbsolutePath. After doing so everything work perfectly for me.
I am sure that for those that use PHP or ASP(x) or any of the other supported languages you should be able to follow the same principal in the other respective config files. Hopefully this little tidbit of instruction will help others save time integrating FCKeditor within their application.
Now get busy and do something good and productive!!
- Slap
Here is my scenario:
I have developed a content management system in ColdFusion whereas I have one set of application code that manages multiple client sites for serving up both front and back end client content. Each client has their own content directory for storing site related files. Their content directory must be relative to their actual directory path. After a little trial and error here is what I manged to do...
Edit the config.cfm file. It is located at /fckeditor/editor/filemanager/connectors/cfm/config.cfm. I set my own variable that can pull the client's directory value I have stored in their respective database. For the sake of simplicity let's just set a static variable. So just before the <cfscript> tag (about line 24/25) I set the following:
Establish Path Variable
<cfset clientpath = "/assets/UserFiles/">
Again, you can have "/assets/UserFiles" be a query result that populates the path as it relates to each client. Just a NOTE: I just happen to prefix the UserFiles with "/assets" just because I have my editor do other things within the client's ASSET folder. You obviously can set this to whatever works for you.
Setting the Config.Enabled to equal 'true'
CHANGE FROM
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true") Config.Enabled = false ;
CHANGE TO
// SECURITY: You must explicitly enable this "connector". (Set enabled to "true") Config.Enabled = true ;
Set the Config.UserFilesPath to equal "clientpath". This sets the relative path value.
CHANGE FROM
// Path to uploaded files relative to the document root. Config.UserFilesPath = "/userfiles/" ;
CHANGE TO
// Path to uploaded files relative to the document root. Config.UserFilesPath = "#clientpath#" ;
Set the absolute variable
Next is to set the absolute path that is on the server within Config.ServerPath. To do this we take our same relative path value and enclose it in ColdFusion's "expandpath" function. This enables CF to convert the relative path into an absolute path.
CHANGE FROM
// Use this to force the server path if FCKeditor is not running directly off // the root of the application or the FCKeditor directory in the URL is a virtual directory // or a symbolic link / junction // Example: C:\inetpub\wwwroot\myDocs\ Config.ServerPath = "" ;
CHANGE TO
// Use this to force the server path if FCKeditor is not running directly off // the root of the application or the FCKeditor directory in the URL is a virtual directory // or a symbolic link / junction // Example: C:\inetpub\wwwroot\myDocs\ Config.ServerPath = "#expandpath(clientpath)#" ;
After making the above settings I assumed that it would have solved my path problem but it didn't. When trying to browse the server directory it was taking me to "/assets/UserFiles/Image" instead of "/assets/UserFiles/". So where was "/Image" coming from? A little further down in the config.cfm file (about line 116) there is an "Image" section that will have to be changed so the paths are pulled and inserted correctly.
CHANGE FROM
Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ; Config.DeniedExtensions["Image"] = "" ; Config.FileTypesPath["Image"] = Config.UserFilesPath & 'image/' ; Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath & 'image/') ) ; Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ; Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ;
CHANGE TO
Config.AllowedExtensions["Image"] = "bmp,gif,jpeg,jpg,png" ; Config.DeniedExtensions["Image"] = "" ; Config.FileTypesPath["Image"] = Config.UserFilesPath ; Config.FileTypesAbsolutePath["Image"] = iif( Config.ServerPath eq "", de(""), de(Config.ServerPath) ) ; Config.QuickUploadPath["Image"] = Config.FileTypesPath["Image"] ; Config.QuickUploadAbsolutePath["Image"] = Config.FileTypesAbsolutePath["Image"] ;
As you can see I had to remove the "& 'image/' " parts from Config.FileTypesPath and Config.FileTypesAbsolutePath. After doing so everything work perfectly for me.
I am sure that for those that use PHP or ASP(x) or any of the other supported languages you should be able to follow the same principal in the other respective config files. Hopefully this little tidbit of instruction will help others save time integrating FCKeditor within their application.
Now get busy and do something good and productive!!
- Slap
Re: Setting Dynamic FCKeditor Relative Paths - ColdFusion
I followed your instructions. But, I'm still not having any luck with uploading images. My CF application is sitting on a Sun box in the following folder: /export/htdocs/folderA/folderB/myApp. FCKEditor sits in /export/htdocs/folderA/folderB/myApp/fckeditor. The desired image upload path is /export/htdocs/folderA/folderB/myApp/upImages. I set the "clientpath" variable in config.cfm to APPLICATION.imageUploadPath which is /folderA/folderB/myApp/upImages. I verified that ExpandPath(clientpath) for Config.ServerPath will equal /export/htdocs/folderA/folderB/myApp/upImages. upImages exists where it should. Yet when I try to upload an image, nothing happens. I just get a continuous progress bar. Also, pressing the "Browse Server" button produces the following error:
The server didn't send back a proper XML response. Please contact your system administrator.
Requested URL:
/folderA/folderB/myApp/fckeditor/editor/filemanager/connectors/cfm/connector.cfm?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1227202095622
Re: Setting Dynamic FCKeditor Relative Paths - ColdFusion